我使用多个spring-boot子项目配置了一个gradle项目,它看起来构建得很好,但由于某种原因,在“发行版”目录中有两个归档文件,一个带有"-boot“后缀,另一个没有。带有后缀的jar文件只包含当前项目jar,没有任何依赖项,没有后缀的jar文件包含启动应用程序所需的所有内容。我非常确定,上次我尝试构建spring-boot项目时,没有生成其他归档文件,我也不确定发生了什么变化。我如何才能阻止这些对我无用的档案的产生?
父项目build.gradle:
allprojects {
group '...'
apply plugin: 'java'
}
subprojects {
sourceCompatibility = 1.9
targetCompatibility = 1.9
repositories {
...
}
}spring-boot子项目build.gradle:
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
mainClassName = '...'
dependencies {
...
}
buildscript {
ext {
springBootVersion = '2.0.0.M5'
}
repositories {
...
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}发布于 2017-11-08 02:10:55
boot发行版打包了应用程序的fat jar或war文件。换句话说,它的所有依赖项都打包在jar或war中,而不是单独的lib目录中。
如果您不希望生成来自boot发行版的归档,您可以禁用创建它们的任务:
bootDistZip.enabled = false
bootDistTar.enabled = falsehttps://stackoverflow.com/questions/47161119
复制相似问题