简体   繁体   English

如何在Nexus存储库管理器中绑定Maven工件的版本?

[英]How do you peg versions of Maven artifacts in the Nexus repository manager?

I'm building against various Lucene and Solr Maven artifacts from Apache's Maven repository hosted in the Nexus repository manager. 我正在构建针对Nexus存储库管理器中托管的Apache的Maven存储库中的各种Lucene和Solr Maven工件。 The artifacts are version 4.0-SNAPSHOT and get updated daily, with older artifacts being deleted regularly. 工件是版本4.0-SNAPSHOT并且每天更新,定期删除旧工件。

I was wondering how to peg the artifacts to a specific date, so whenever a Maven client would ask for solr-core 4.0-SNAPSHOT , it would get the same version even if there was a newer one upstream. 我想知道如何将工件挂钩到特定的日期,所以每当Maven客户端要求solr-core 4.0-SNAPSHOT ,即使上游有一个较新的版本,也会得到相同的版本。

I would also like to know how to explicitly update to the latest 4.0-SNAPSHOT , but still keep all previous versions that were downloaded. 我还想知道如何显式更新到最新的4.0-SNAPSHOT ,但仍然保留所有以前下载的版本。

Specifically, the "Apache Snapshots" repository is the default one that comes setup when you install Nexus. 具体来说,“Apache Snapshots”存储库是安装Nexus时设置的默认存储库。

You can use the versions maven plugin to pin to a particular version of SNAPSHOT which is only valid as long as the SNAPSHOT is available in the appropriate repository. 您可以使用版本maven插件固定到特定版本的SNAPSHOT,只有SNAPSHOT在相应的存储库中可用时才有效。 But i would recommend to use a repository manager and get the SNAPSHOT's into a local repository and work with them instead. 但我建议使用存储库管理器并将SNAPSHOT放入本地存储库并改为使用它们。 What's also possible is to get a particular SNAPSHOT and make an internal release out of it for exmaple 4.0.1-INTERNAL like and make longer available based on that. 还有一种方法是获得一个特定的SNAPSHOT,并为其提供内部版本,例如4.0.1-INTERNAL,并根据它提供更长的可用时间。

When a snapshot is deployed to a repository server each new deployment is actually deployed as a time stamped version with an iterator number appended. 将快照部署到存储库服务器时,每个新部署实际上都部署为带有迭代器编号的带时间戳的版本。 If you want to use a specific version you just use the timestamp version of the snapshot rather than -SNAPSHOT. 如果要使用特定版本,只需使用快照的时间戳版本而不是-SNAPSHOT。

Eg look at https://repository.apache.org/content/groups/snapshots/org/apache/maven/artifact/maven-artifact/3.0-alpha-2-SNAPSHOT/ 例如, 查看https://repository.apache.org/content/groups/snapshots/org/apache/maven/artifact/maven-artifact/3.0-alpha-2-SNAPSHOT/

You could use this artifact as 您可以将此工件用作

<groupId>org.apache.maven.artifact</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0-alpha-2-SNAPSHOT</version>

which would change it each time a new snapshot is deployed or you could use 每次部署新快照或您可以使用时,它都会更改它

<groupId>org.apache.maven.artifact</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0-alpha-2-20090214.020928-1</version>

which would stay the same. 哪个会保持不变。 Keep however in mind that a snapshot repository is NOT static by nature and these artifacts could potentially disappear completely. 但请记住,快照存储库本质上不是静态的,并且这些工件可能会完全消失。 Only do that if you are using an internal repository server that you can control and therefore ensure that those snapshots don't disappear on you. 只有在使用可以控制的内部存储库服务器时才这样做,从而确保这些快照不会消失在您身上。

Another way to do it is to actually cut a release and use that.. 另一种方法是实际切割一个版本并使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Java从Maven Nexus存储库下载工件列表 - How to download list of artifacts from maven nexus repository using Java Nexus / Maven如何不通过Nexus代理所有内容 - Nexus/Maven how do you NOT proxy everything through Nexus Sonatype Nexus:如何使用Seagate个人云存储设备作为Maven工件的存储库? - Sonatype Nexus: How to use my Seagate personal cloud storage device as a repository for my maven artifacts? Jenkins使用部署到Maven存储库将工件部署到Nexus - Jenkins Deploy Artifacts to Nexus using Deploy to Maven Repository 如何使用Nexus存储库解决Maven中的依赖性错误 - How to resolve dependency errors in Maven with Nexus repository Maven Nexus资料库 - Maven Nexus Repository 将Nexus资源库用于Maven - Use Nexus repository for Maven 使 Sonatype Nexus 存储库可公开访问,以便能够使用 URL 下载工件,例如 maven 中央 - Making Sonatype Nexus Repository publically accessible to be able to download artifacts with URL like maven central 如何将Nexus maven存储库索引(nexus-maven-repository-index)移动到其他目录(不是临时) - How to move Nexus maven repository index (nexus-maven-repository-index) to other directory (not temp) Nexus Reposiotry Manager:3.0.2 _它是否支持Maven 3,就像创建存储库时一样,它仅显示Maven 2 - Nexus Reposiotry manager: 3.0.2 _ does it supports Maven 3, as while creat repository, it shows only Maven 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM