Maven 发布插件:使用 SNAPSHOT 版本发布
我知道,发布具有 SNAPSHOT 依赖项的项目不是一个好习惯。
但是,我想知道,有什么办法,我们可以让maven发布插件以SNAPSHOT依赖项发布?
是否有任何参数可以传递给 Maven 发布插件以在发布时接受依赖项的快照版本?
喜欢
-Dallow.snapshots= true
I know, its not a good practice to release a project with SNAPSHOT dependencies.
But, I would like to know, Is there any way, we can make maven release plugin to release with SNAPSHOT dependencies?
Is there any parameters that I can pass to the maven release plugin to accept SNAPSHOT version of the dependencies while releasing?
Like
-Dallow.snapshots= true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以考虑使用
allowTimestampedSnapshots
选项来release:准备
。这显然是为了处理快照依赖性不可避免的用例而添加的。但只有在不可避免的情况下才应该这样做。除此之外,一些 Maven 存储库可以配置为自动删除旧的 SNAPSHOT 版本。如果发生这种情况,您发布的工件最终可能会永久破坏依赖关系。
You could consider using the
allowTimestampedSnapshots
option torelease:prepare
. This was apparently added to deal with use-cases where SNAPSHOT dependencies are unavoidable.But you should only do this if it is unavoidable. Among other things, some Maven repositories can be configured to automatically delete old SNAPSHOT releases. If that happened, your released artifacts could end up with permanently broken dependencies.
你为什么想要那个?发布的版本应该永远不会改变。更新快照依赖项之一可能会导致系统崩溃。我看到两种方法:
要么您可以控制依赖项的源代码,在这种情况下,我建议您完成发布这些项目的过程(尽管很乏味)。
如果您不控制源代码,您仍然可以重命名二进制文件并将其手动上传到发布服务器。即使对于您控制下的项目,您仍然可以采用这种方法,尽管我强烈建议您不要这样做。
Why would you want that? A released version is supposed to never change. Updating one of the snapshot dependencies risks breaking the system. I see two approaches:
Either you have control over the source code of your dependencies, in which case I recommend you to go through the, albeit tedious, process of releasing those projects.
If you don't control the source code you can still rename the binary and manually upload it to your release server. You might still take this approach even for projects under your control, although I strongly encourage you not to.