java 为什么快照名称的 jar 文件名中总是包含日期?如何删除它
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6920536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why the snapshot name always has date in its jar file name ? How to remove it
提问by zjffdu
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 ?
当我部署 jar 时,maven 总是在其文件名中添加日期,这使得文件名存储库与我本地的文件不同。如何删除文件名中的日期?
Thanks
谢谢
回答by Simone Gianni
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.
关于为什么,这是因为它是一个 SNAPSHOT 包,每次部署它时实际上都在部署它的新版本,因此添加时间戳以在远程存储库中区分它们。当 Maven 下载它时,它会删除时间戳,因为在您的本地存储库上只能有一个版本,所以如果不混淆,时间戳是没有用的。
It can be removed, this siteuse the -DuniqueVersion=false
parameter :
可以删除,本站使用-DuniqueVersion=false
参数:
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.
但是,您不应该关心工件名称、文件等。您使用的是 maven,因此您不必关心它们。