Nexus 中的发布存储库策略是否确保 jar 永远不会改变?

发布于 2024-09-12 08:38:31 字数 271 浏览 8 评论 0原文

我正在部署 Nexus OSS 作为内部公司存储库。 主要要求之一是,一旦 Nexus 下载了 jar(例如,当使用 is 作为 Maven Central 的代理时),它就永远不会改变。 我知道 Maven Central 有该政策,但我正在使用不受我控制的其他存储库,并且我必须在我这边验证该要求。

发布存储库策略是否确保一旦将 jar 下载到该存储库中,它就永远不会改变?

该要求的存在是为了确保我们可以返回到 1.5 年前创建的产品版本,并确保产品使用的存储库工件与现在构建产品时相同。

I'm in the process of deploying Nexus OSS as internal company repository.
One of the main requirements is that once a jar has been downloaded by Nexus (for example, when using is as a proxy of Maven Central) it will never change.
I know that Maven Central has that policy, but I'm using other repositories which are not under my control, and I have to validate that requirement on my side.

Does a Release repository policy ensures that once a jar is downloaded into that respository, it will never change?

The requirement exists to ensure we can go back to a version of our product created 1.5 years ago, and make sure the repository artifacts used by the product are the same when building it now.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人哭 2024-09-19 08:38:31

事实上,发布存储库应该严格禁止发布后的内容修改,这就是 Maven Central 正在做的事情:

2.2.4。中央 Maven 存储库

(...) 这里有一些
释放特性
存储库,例如 Central Maven
存储库:

...

发布稳定性

一旦发布到 Central Maven
存储库、工件和
描述该工件的元数据
永远不会改变。释放此属性
存储库保证项目
这取决于版本将是
随着时间的推移可重复且稳定。尽管
新的软件工件正在被
每天向中央发布一次
工件被分配了一个版本
中环号码有严格规定
禁止修改内容的政策
后的软件工件
发布。

话虽如此,Maven 客户端是否会(重新)下载工件并不真正取决于存储库及其策略,这是 Maven DNA 的一部分,并且它不会发生(除非您从您的应用程序中删除给定的工件)当然是本地存储库)。在 [MNG-2528] 中引用 Brett Porter - updatePolicy“always”不适用于具有“releases”的存储库“,至少对于传递依赖来说不是

根据定义,Maven 中的版本是不变的。始终标志是检查新版本(就像查找新快照一样),而不是对现有版本的修改。

换句话说,如果您不删除 Nexus 存储库的内容,Nexus 将永远不会再次重新下载已发布的工件,因此您将能够使用完全相同的库重建两年前创建的产品版本。

Indeed, a release repository should strictly forbid content modification after a release, which is what Maven Central is doing:

2.2.4. The Central Maven Repository

(...) Here are some
of the properties of release
repositories such as the Central Maven
repository:

...

Release Stability

Once published to the Central Maven
repository, an artifact and the
metadata describing that artifact
never change. This property of release
repositories guarantees that projects
which depend on releases will be
repeatable and stable over time. While
new software artifacts are being
published to central every day, once
an artifact is assigned a release
number on Central, there is a strict
policy against modifying the contents
of a software artifact after a
release.

That being said, whether a Maven client will (re)download an artifact or not does not really depend on the repository and its policy, this is part of Maven DNA and it just won't happen (unless you delete the given artifact from your local repository of course). Quoting Brett Porter in [MNG-2528] - updatePolicy "always" does not work for repositories with "releases", at least not for transitive dependencies:

Releases in Maven are, by definition, unchanging. The always flag is to check for new releases (like it looks for new snapshots), not modifications to the existing one.

In other words, if you don't delete the content of your Nexus repository, Nexus will never re-download a released artifact again and you will thus be able to rebuild the version of your product created two years ago, using the exact same libraries.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文