I am using the Jenkins-Artifactory plugin to deploy a jar file to a repo in Artifactory. Build tool being used is gradle. The process does not seem to maintain multiple timestamped versions of the jar artifact.
The repository uses 'gradle-default' layout. Maven snapshot version behavior has been set to 'Unique'. Max unique snapshots set to 30.
I am using rtUpload and rtPublishBuildInfo to upload the jar and corresponding buildinfo to Artifactory.
I see multiple versions of buildinfo under 'artifactory-build-info' repository in format BUILDNUMBER_TIMESTAMP.json However the application jar is being overwritten every time with name as appname-VERSION.jar, thus keeping only the latest version in repo.
I have tried changing Maven snapshot version behavior to 'Non-Unique' and adding 'SNAPSHOT' to version string. This did not resolve the issue
pipeline code for uploading artifacts
// upload build artifacts to artifact repository
stage('publish to artifactory') {
steps {
rtUpload (
serverId: "ARTIFACTORY_SERVER_ID",
spec:
"""{
"files": [
{
"pattern": "kotlin-source/build/libs/appname-*.jar",
"target": "gradle-dev-local"
}
]
}""",
failNoOp: true,
)
}
}
stage ('Publish build info') {
steps {
rtPublishBuildInfo (
serverId: "ARTIFACTORY_SERVER_ID",
)
}
}
expected multiple artifacts to be present in the repo with timestamp appended to the name. Only a single jar is seen under the repo. After the artifact is published, existing jar in the repo is moved to Trash Can