1、今天在对一个自己的项目进行打包的时候,一直打包失败,后来原来是因为在根目录打包失败了,要在主项目运行下进行打包,截图如下:
运行:
gradle build
查看结果:
打包成功!
那接下来看配置gradle配置
group 'calories'
buildscript {
ext {
springBootVersion = '1.5.8.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile project(":lib-sys")
compile project(":lib-common")
compile project(":lib-goods")
compile project(":lib-user")
compile project(":lib-store")
compile('org.springframework.boot:spring-boot-starter')
compile("org.springframework.boot:spring-boot-starter-freemarker")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-data-redis")
compile("org.springframework.boot:spring-boot-starter-websocket")
compile("org.springframework.boot:spring-boot-devtools")
//开发,运行的时候,使用
// compile("org.springframework.boot:spring-boot-starter-tomcat")
compile("mysql:mysql-connector-java")
compile("com.zaxxer:HikariCP:2.6.2")
compile("org.springframework.boot:spring-boot-starter-web")
//打包的时候使用
providedCompile("org.springframework.boot:spring-boot-starter-tomcat")
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testCompile('org.springframework.boot:spring-boot-starter-test')
}
124 篇文章
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!