Skip to content

Commit

Permalink
Configure Jar task with Jenkins build number
Browse files Browse the repository at this point in the history
  • Loading branch information
Aquerr committed Apr 22, 2023
1 parent f41e45a commit a14a283
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ java {
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType(Jar::class).configureEach {
if(System.getenv("JENKINS_HOME") != null) {
archiveVersion.set(project.version.toString() + "_" + System.getenv("BUILD_NUMBER") + "-SNAPSHOT")
println("Version => " + project.version.toString())
} else {
archiveVersion.set(project.version.toString() + "-SNAPSHOT")
}
}

tasks.withType(JavaCompile::class).configureEach {
options.apply {
encoding = "utf-8" // Consistent source file encoding
Expand Down

0 comments on commit a14a283

Please sign in to comment.