问题
I am uploading a few artifacts through a Jenkins pipeline on a Nexus repository, the repository is maven2 hosted. I use the following block in Jenkins to upload artifacts:
nexusArtifactUploader (
artifacts: [
[artifactId: 'artifact-part1',
classifier: '',
file: "build/libs/artifact-part1.jar",
type: 'jar'],
[artifactId: 'artifact-part2',
classifier: '',
file: "build/libs/artifact-part2.jar",
type: 'jar']
],
credentialsId: 'nexus_cred',
groupId: "$group", nexusUrl: "$nexusUrl:8082",
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'project_dev',
version: "$version-SNAPSHOT"
)
It gets uploaded to nexus but the file name has a suffix of timestamp. I am not mentioning the timestamp anywhere, I am not sure how it gets added. This is how it looks:
I don't wan't the timestamp to be added. Adding the timestamp creates multiple versions, I would like to know if there is any way of removing the timestamp so that only one version is saved. What can I do?
回答1:
Snapshot artifacts are automatically stored with a timestamp inside the repository. You can still reference them by 0.1-SNAPSHOT
and Nexus will automatically resolve that.
So don't worry.
回答2:
Adding to answer by JF Meier. I later found out that adding timestamps to SNAPSHOTS is the intended functionality. You can read more about it here : What is an Artifact Repository?
Credits to Ian W
来源:https://stackoverflow.com/questions/57951722/how-to-remove-timestamp-from-artifacts-uploaded-to-maven2-repository-on-nexus