官术网_书友最值得收藏!

Setting up Spring Boot with Gradle

We have seen that Java 8 is the minimum requirement for Spring Boot 2.0, both with Maven and Gradle. However, if you want to use Gradle, then first install Gradle 4 or above in your machine from www.gradle.org/.

Now, see the following Gradle Spring Boot dependencies file with org.springframework.boot groupId. Here's what the build.gradle file should look like:

buildscript {
   repositories {
         jcenter()
         maven { url 'http://repo.spring.io/snapshot' }
         maven { url 'http://repo.spring.io/milestone' }
   }
   dependencies {
         classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M7'
   }
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

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

repositories {
   jcenter()
   maven { url "http://repo.spring.io/snapshot" }
   maven { url "http://repo.spring.io/milestone" }
}

dependencies {
   compile("org.springframework.boot:spring-boot-starter-web")
   testCompile("org.springframework.boot:spring-boot-starter-test")
}
 

The preceding Gradle file has minimum requirements for the Spring Boot application. You could use either Maven or Gradle since the process is the same. Spring Boot creates an application using the same process.

Let's create your first Spring Boot application and see how to set up the project's structure using Spring Boot Initializr.

主站蜘蛛池模板: 三台县| 株洲县| 瑞金市| 镇沅| 汉源县| 红原县| 金华市| 固阳县| 蓝山县| 黄浦区| 临夏县| 临泉县| 邛崃市| 乳源| 永丰县| 廉江市| 焉耆| 浏阳市| 霍林郭勒市| 旬邑县| 娄烦县| 沂水县| 乌鲁木齐县| 长治市| 宝兴县| 定安县| 彝良县| 武威市| 武威市| 麻江县| 永顺县| 建昌县| 桑植县| 丹江口市| 上思县| 普宁市| 沙坪坝区| 济南市| 定结县| 囊谦县| 静宁县|