'In Gradle, how can I append Jenkins build number to artifact version in a Jenkins pipeline?
Gradle v7.3.3
In my gradle.properties file, I have the artifact version set to 2.0
gradle.properties
-----------------
version=2.0
Now when I do a Jenkins build, I want to append the build number to that version, and publish the subsequent artifact. That is, I want the artifact to be
com.company.com:myproject:2.0.<build_number>
I tried
sh "./gradlew :myproject:clean :myproject:build -x test -PartifactBuildNumber=$env.BUILD_NUMBER -p myproject"
sh "./gradlew publish -x build -x test -PartifactBuildNumber=$env.BUILD_NUMBER -p myproject"
But of course that only has the Jenkins build number in the artifact version, instead of the desired 2.0.<BUILD_NUMBER>. Is there an elegant way to do this
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
