问题描述
如何在Spring Boot Gradle项目中向jar添加时间戳?
./gradlew build
创建jar app-0.0.1-SNAPSHOT.jar
,以及如何使用时间戳创建jar
app-0.0.1-SNAPSHOT-2020-11-09.02-30.jar
-------- Gradle
plugins {
id 'org.springframework.boot' version '2.3.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage',module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
解决方法
怎么样
\b
已通过gradle bootJar {
archiveFileName = "app-0.0.1-SNAPSHOT-"+new Date().format('yyyy-MM-dd.HH-mm')+ ".jar"
}
和spring boot插件版本6.6.1
进行了测试