【发布时间】:2017-12-21 09:33:07
【问题描述】:
我一直在关注 spring 提供的教程,似乎无法理解为什么我的 .war 文件是空的。点击here查看/下载代码。最终目标是下载此文件,构建一个 .war 文件,然后将其部署到我的 tomcat 服务器。我已将以下内容添加到 build.gradle
应用插件:“战争”
但这只会产生一个包含零类文件的战争。
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle
plugin:1.5.3.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
// end::actuator[]
// tag::tests[]
testCompile("org.springframework.boot:spring-boot-starter-test")
// end::tests[]
}
【问题讨论】:
-
您是否也尝试过将 jar 块(带有 baseName 和版本)重命名为 war?
-
是的,但没有区别
标签: spring tomcat spring-boot gradle war