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

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.

主站蜘蛛池模板: 阳泉市| 东海县| 咸丰县| 武强县| 芦溪县| 甘泉县| 汪清县| 郎溪县| 抚州市| 扶沟县| 达州市| 年辖:市辖区| 惠来县| 巫山县| 渭源县| 游戏| 囊谦县| 东港市| 尤溪县| 依安县| 公主岭市| 张北县| 准格尔旗| 莱西市| 临邑县| 浮梁县| 横峰县| 新民市| 左云县| 宾川县| 应城市| 兴安盟| 科技| 于田县| 灵丘县| 兴文县| 桦川县| 武定县| 桓台县| 哈巴河县| 封丘县|