gradle - 如何将 src/dist 添加到 Spring Boot 发行版
问题描述
看起来 spring boots gradle 插件没有像应用程序插件那样打包 src/dist 的内容。如何将 src/dist add 的内容添加到我的 Spring Boot 发行版 zip 和 tar?
plugins {
id 'java'
id 'application'
id 'org.springframework.boot' version '2.0.2.RELEASE'
id "io.spring.dependency-management" version "1.0.5.RELEASE"
}
version '1.0-SNAPSHOT'
repositories {
jcenter()
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
mainClassName = "kic.data.server.Server"
dependencies {
compile 'org.springframework.boot:spring-boot-starter'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.apache.commons:commons-lang3:3.7'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile 'org.spockframework:spock-core:1.1-groovy-2.4'
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile "com.github.tomakehurst:wiremock-standalone:2.16.0"
}
解决方案
我可以解决它。要添加回src/dist/
文件夹,我只需将其添加到我的 build.gradle 中。遗憾的是,spring boot 支持在配置文件夹中查找文件,但分发插件只是忽略它。
bootDistZip {
into("${project.name}-boot-${project.version}") {
from './src/dist/'
}
}
bootDistTar {
into("${project.name}-boot-${project.version}") {
from './src/dist/'
}
}
推荐阅读
- r - 在R中提取栅格区域的有效方法
- terraform - 从 terraform v12 语法中的变量计算局部变量
- mongodb - 备份 mongodb docker 实例的最佳策略?
- amazon-web-services - Is the t2.micro instance enough to fetch hundreds of thousands of rows?
- angular - socket.io client Angular Cannot read property 'emit' of undefined
- python - Juypter 笔记本 pandas_profiling:无法从“pandas_profiling.report”导入名称“to_html”
- azure-sphere - Azure Sphere (Seeed Studio) 更新到 20.01 但现在无法启用开发者模式
- javascript - 在Javascript中操作对象数组
- haskell - Haskell 中的 <* 语法
- automapper - 将映射集合的批处理结果一次性处理