Gradle settings

Gradle is an open source build automation tool that uses scripts written in Groovy or Kotlin DSL. It's supported by the major IDEs, and you can run it using command-line interfaces, or through a continuous integration server.

Once it has been installed, you can create a new project (or automatically convert an existing Maven project into a Gradle one) by launching the following command from your project's root:

$ gradle init

In order to use Spring Boot in a Gradle project, you can create a Gradle file such as the following:

plugins {
id 'org.springframework.boot' version '2.0.5.RELEASE'
id 'java'
}

jar {
baseName = 'myproject'
version = '0.0.1-SNAPSHOT'
}

repositories {
jcenter()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-dependencies:2.0.5.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

In this XML file, I added the Spring Boot BOM file as the first dependency, with the specified Spring Boot version, in order to use the right versions of all Spring Boot modules.

To build the executable JAR file, you can execute the following command:

$ ./gradlew mySpringBootJar

After that, you can run it by executing the following command:

$ java -jar build/libs/gradle-my-spring-boot-project.jar

Or you can execute the following Gradle command:

$ ./gradlew bootRun
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset