使用Gradle构建Spring_Boot应用 发表于 2019-07-29 | 分类于 技术 使用Gradle构建Spring_Boot应用 使用Gradle构建Spring_Boot应用项目结构123456789101112131415161718192021222324252627282930C:.│ .gitignore│ .project│ build.gradle│ settings.gradle│└─src ├─main │ ├─java │ │ └─com │ │ └─bob │ │ └─boot │ │ │ MyApplication.java │ │ │ │ │ ├─config │ │ │ MyConfig.java │ │ │ MyConfigBean.java │ │ │ │ │ ├─controller │ │ │ MyController.java │ │ │ │ │ └─domain │ │ Person.java │ │ │ └─resources │ application.yml │ └─test ├─java └─resources build.gradle模板,以后在此模板基础上改就行 123456789101112131415161718192021222324252627282930313233343536373839404142434445buildscript { ext { springBootVersion = '2.1.3.RELEASE' } repositories { maven { url 'https://repo.spring.io/release' } mavenCentral() } dependencies { classpath ( "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}", "io.spring.gradle:dependency-management-plugin:1.0.7.RELEASE" ) }}apply { plugin("java") plugin("maven") plugin("idea") plugin("org.springframework.boot") plugin("io.spring.dependency-management")}group 'com.bob'version '1.0-SNAPSHOT'sourceCompatibility = 1.8targetCompatibility = 1.8repositories { maven { url 'https://repo.spring.io/release' } mavenCentral()}dependencies { compile ( 'org.springframework.boot:spring-boot-starter-web', 'org.springframework.boot:spring-boot-loader' )} 命令123gradle bootRungradle bootJar