spring boot gradle 打成war包

spring boot gradle 打成war包,idea spring boot 打包,idea gradle打包,springboot gradle 打包

1、今天在对一个自己的项目进行打包的时候,一直打包失败,后来原来是因为在根目录打包失败了,要在主项目运行下进行打包,截图如下:

attachments-2017-12-mO7yMWEJ5a4318cd30bce.

运行:

gradle build

查看结果:

attachments-2017-12-MY3zdFLA5a4318fce248d.

打包成功!


那接下来看配置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')

}
按照上述配置一定成功,如果你遇到了无法解决的问题,欢迎联系我。
在下定会知无不言言无不尽!!!!
  • 发表于 2017-12-27 11:54
  • 阅读 ( 2069 )
  • 分类:Java

0 条评论

请先 登录 后评论
不写代码的码农
威猛的小站长

124 篇文章

作家榜 »

  1. 威猛的小站长 124 文章
  2. Jonny 65 文章
  3. 江南烟雨 36 文章
  4. - Nightmare 33 文章
  5. doublechina 31 文章
  6. HJ社区-肖峰 29 文章
  7. 伪摄影 22 文章
  8. Alan 14 文章