maven -SNAPSHOT 关键字未替换
我有一个带有
和
的 Maven 项目。当我运行 mvn clean install
时,它将以下内容部署到我的本地存储库
~/.m2/repository/com/example/myproject/0.0.11-SNAPSHOT/Commons-0.0.11-SNAPSHOT.jar
我预计生成的工件的名称将由 -SNAPSHOT
替换为JAR 构建时间的时间戳,例如:
~/.m2/repository/com/example/myproject/0.0.11-SNAPSHOT/Commons-0.0.11-20110217011633.jar
为什么这种替换没有发生?
I have a Maven project with <packaging>jar</packaging>
and <version>0.0.11-SNAPSHOT</version>
. When I run mvn clean install
, it deploys the following to my local repository
~/.m2/repository/com/example/myproject/0.0.11-SNAPSHOT/Commons-0.0.11-SNAPSHOT.jar
I expected that the name of the generated artifact would have -SNAPSHOT
replaced by a timestamp of when the JAR was built, something like:
~/.m2/repository/com/example/myproject/0.0.11-SNAPSHOT/Commons-0.0.11-20110217011633.jar
Why is this replacement not happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我重读了这个问题,看起来你在谈论你的本地机器。 我怀疑您是否可以在本地存储库中存储唯一版本
请参阅:存储库 -快照处理,它说
还,
下面的描述是针对私有存储库的。
在私有存储库中:
您需要配置本地存储库来存储唯一 SNAPSHOT 版本。 AFAIK,Artifactory 和 Nexus 中有一个设置可以做到这一点。
请参阅此处:http://wiki.jfrog.org/confluence/display/RTF/Local+Repositories
我没有使用过 Nexus,但似乎默认情况下它存储唯一的快照,您可以定义要保留快照的天数。我没有收到文章,但您可以查看 http:// www.sonatype.com/books/nexus-book/reference/config-sect-scheduled-services.html
另外,您可以在分发管理块中明确指示 uniqueVersion 为 true。但是,我想默认情况下是这样。也许给它一个机会,
I reread the question, seem like you're talking about your local machine. I doubt that you could store Unique version in local repository
refer this: Repository - SNAPSHOT Handling, it says
Also,
The description below is for private repository.
In a private repositiry:
You need to configure your local repository to store unique SNAPSHOT versions. AFAIK, there is a setting in Artifactory and Nexus to do this.
See here: http://wiki.jfrog.org/confluence/display/RTF/Local+Repositories
I havn't used Nexus, but seems like by default it stores unique snapshot and you can define how many days you want to keep the SNAPSHOT. I didn't get an article but you may look into http://www.sonatype.com/books/nexus-book/reference/config-sect-scheduled-services.html
Also, you may explicitely indicate uniqueVersion as true in distribution management blocl. But, I guess that true by default. may be give it a chance,
我认为当您将工件
部署
到快照存储库时,您所写的内容(替换SNAPSHOT
令牌)是正确的。但是install
的工作原理(至少对我来说)正如您所描述的那样 - 所以它不会用时间戳替换SNAPSHOT
。I think what you wrote (replacing
SNAPSHOT
token) is true when youdeploy
the artifact to snapshot repository. Butinstall
works (at least for me) as you udescribed - so it doesn't replace theSNAPSHOT
with timestamp.