Skip to content

Commit a14a283

Browse files
committed
Configure Jar task with Jenkins build number
1 parent f41e45a commit a14a283

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ java {
2424
targetCompatibility = JavaVersion.VERSION_11
2525
}
2626

27+
tasks.withType(Jar::class).configureEach {
28+
if(System.getenv("JENKINS_HOME") != null) {
29+
archiveVersion.set(project.version.toString() + "_" + System.getenv("BUILD_NUMBER") + "-SNAPSHOT")
30+
println("Version => " + project.version.toString())
31+
} else {
32+
archiveVersion.set(project.version.toString() + "-SNAPSHOT")
33+
}
34+
}
35+
2736
tasks.withType(JavaCompile::class).configureEach {
2837
options.apply {
2938
encoding = "utf-8" // Consistent source file encoding

0 commit comments

Comments
 (0)