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

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.

主站蜘蛛池模板: 克东县| 武胜县| 怀柔区| 收藏| 唐河县| 武鸣县| 巴林左旗| 澎湖县| 凤城市| 西华县| 华坪县| 霍林郭勒市| 察隅县| 饶阳县| 霞浦县| 蒙山县| 庆阳市| 家居| 鲜城| 额尔古纳市| 色达县| 江安县| 南宁市| 六安市| 光山县| 依兰县| 依安县| 乳源| 稻城县| 富裕县| 汉阴县| 淮阳县| 健康| 绵阳市| 额济纳旗| 沾化县| 台北县| 长沙县| 昌图县| 许昌市| 八宿县|