14

When I deploy jar, maven always add date in its file name, this make the file name repository different from the file in my local. How can I remove the date in file name ?

Thanks

zjffdu
  • 25,496
  • 45
  • 109
  • 159
  • 1
    What is your goal? If you're deploying "just testing" versions, they're *supposed* to have a timestamp on them. If you're deploying "finished" copies, then you should be doing a release and not using a SNAPSHOT version. – Darien Aug 03 '11 at 01:15

1 Answers1

30

About why, it's because being it a SNAPSHOT package, each time you deploy it you are de-facto deploying a new version of it, so the timestamp is added to differentiate them in the remote repository. When Maven downloads it, it removes the timestamp because on your local repository there can only be one version, so the timestamp is useless if not confusing.

It can be removed, this site use the -DuniqueVersion=false parameter :

mvn deploy:deploy-file -Durl=file:///C:/m2-repo \
                   -DrepositoryId=some.id \
                   -Dfile=your-artifact-1.0.jar \
                   -DpomFile=your-pom.xml \
                   -DuniqueVersion=false

However, you should NOT care about artifact names, files etc.. You are using maven SO THAT you don't have to care about them.

GGO
  • 2,678
  • 4
  • 20
  • 42
Simone Gianni
  • 11,426
  • 40
  • 49
  • 18
    There are edge cases where removal of the timestamp is useful. Let's not get religious about this.. – ukdavo Jan 27 '12 at 23:36
  • @ukdavo you are right, that's why I posted the link to the maven-deploy manual .. however, since Zjffdu was talking about differences between the remote and local repo, I don't think he was having an edge case the feature was planned for, that's why I encouraged him to rethink its approach to the problem. – Simone Gianni Jan 31 '12 at 22:54
  • 1
    We have a nexus set up to proxy to the nexus which I am publishing snapshots and the timestamps are causing problems with that, so there's an edge case for you. – 2rs2ts Oct 14 '14 at 23:02
  • An edge case where the name matters is if you explicitly list JAR files in your Manifest file. This scenario *shouldn't* happen in a production deployment, but it can definitely happen any time if you're relying on a snapshot. – Nick A. Watts Sep 18 '18 at 12:25