Build tools

Build tools are programs that automate the process of executing applications from source code. Basically the automation process is done by application developers to do things like:

1. Download dependencies.

2. Compile and package source code into binary.

3. Deploy to the production system.

Each build tool used has a different configuration so that it can run. For example, for the gradle build tools, the first step for gradle to run is to download gradle first and then extract the downloaded file. Next add the GRADLE_HOME variable to the environment variable (right click my computer -> properties -> advance system settings -> environment variable ), and also add GRADLE_HOME\bin to the path variable. To find out if gradle is installed or not, just type gradle -v in the cmd console.

The gradle configuration is in the build.gradle file. Here is an example of the contents of the build.gradle file

buildscript {

   ext {

      springBootVersion = ‘2.0.3.RELEASE’

   }

   repositories {

      mavenCentral()

   }

   dependencies {

      classpath(“org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}”)

   }

}

apply plugin: ‘java’

apply plugin: ‘eclipse’

apply plugin: ‘org.springframework.boot’

apply plugin: ‘io.spring.dependency-management’

group = ‘id.co.akhdani’

version = ‘0.0.1-SNAPSHOT’

sourceCompatibility = 1.8

repositories {

   mavenCentral()

}

dependencies {

   // Apache commons

   compile group: ‘org.apache.commons’, name: ‘commons-lang3’, version: ‘3.7’

   compile group: ‘commons-codec’, name: ‘commons-codec’, version: ‘1.9’

   // DB Connection Pool

   compile group: ‘com.zaxxer’, name: ‘HikariCP’, version: ‘3.2.0’

   // thymeleaf

   compile(‘org.springframework.boot:spring-boot-starter-thymeleaf’)

   compile group: ‘nz.net.ultraq.thymeleaf’, name: ‘thymeleaf-layout-dialect’, version: ‘2.3.0’

   compile(‘org.thymeleaf.extras:thymeleaf-extras-springsecurity4’)

   runtime(‘org.postgresql:postgresql’)

   runtime(‘org.springframework.boot:spring-boot-devtools’)

   testCompile(‘org.springframework.boot:spring-boot-starter-test’)

   compile(‘org.springframework.boot:spring-boot-starter-web’)

   compile group: ‘com.fasterxml.jackson.core’, name: ‘jackson-databind’, version: ‘2.9.6’

   compile group: ‘com.fasterxml.jackson.core’, name: ‘jackson-core’, version: ‘2.9.6’

}

To add a gradle library to the project you are working on, you can do this by adding it to the build.gradle file, dependencies. For example, we want to add the hikaricp library to the project, the first step is to search for it on google, usually it will be directed to the mvnrepository.com site. after you have finished choosing which version to use, click on the gradle tab, then copy the text on the tab (for example)

   compile group: ‘com.zaxxer’, name: ‘HikariCP’, version: ‘3.2.0’

into dependencies, so the dependencies will be like this

dependencies {

   // DB Connection Pool

   compile group: ‘com.zaxxer’, name: ‘HikariCP’, version: ‘3.2.0’

}

After the project has been created, the next step is to build the project. how to type

gradle build

on the console or terminal. gradle build functions to compile code into an executable jar file. If the build is successful, a message will appear

BUILD SUCCESSFUL

The need for digital IT is needed in daily activities, Bead IT Consultant is the right choice as your partner, visit our website by clicking this link: www.beadgroup.com