如何从maven SNAPSHOT存储库下载SNAPSHOT版本? [英] How to download SNAPSHOT version from maven SNAPSHOT repository?
问题描述
所以我有一个项目,我定期发布maven没有问题。我现在想要提供这个项目的SNAPSHOT版本。所以我做'mvn clean deploy'。一切正常,如下所示:
So I have a project and I do regular releases to maven without a problem. I now want to make available a SNAPSHOT version of this project. So I do 'mvn clean deploy'. Everything works as you can see below:
[INFO]从sonatype-nexus-snapshots中检索以前的内部版本号
上传: https:/ /oss.sonatype.org/content/repositories/snapshots/me/soliveirajr/menta-regex/0.9.6-SNAPSHOT/menta-regex-0.9.6-20111010.153035-2.jar
5K已上传(menta-regex-0.9.6-20111010.153035-2.jar)
[INFO] Retrieving previous build number from sonatype-nexus-snapshots Uploading: https://oss.sonatype.org/content/repositories/snapshots/me/soliveirajr/menta-regex/0.9.6-SNAPSHOT/menta-regex-0.9.6-20111010.153035-2.jar 5K uploaded (menta-regex-0.9.6-20111010.153035-2.jar)
我去找我的sonatype经理我可以找到快照:
I go to my sonatype manager and I can find the snapshot:
但是现在当我尝试将此快照用作对另一台机器中的其他项目的依赖时,我得到了:
But now when I try to use this snapshot as a dependency on some other project in another machine I get:
<dependency>
<groupId>me.soliveirajr</groupId>
<artifactId>menta-regex</artifactId>
<version>0.9.6-SNAPSHOT</version>
</dependency>
缺失:
1)我。 soliveirajr:menta-regex:jar:0.9.6-SNAPSHOT
1) me.soliveirajr:menta-regex:jar:0.9.6-SNAPSHOT
尝试从项目网站手动下载文件。
Try downloading the file manually from the project website.
然后,使用以下命令安装它:
mvn install:install-file -DgroupId = me.soliveirajr -DartifactId = menta-regex -Dversion = 0.9.6-SNAPSHOT -Dpackaging = jar -Dfile = / path / to / file
Then, install it using the command: mvn install:install-file -DgroupId=me.soliveirajr -DartifactId=menta-regex -Dversion=0.9.6-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
或者,如果您拥有自己的存储库,则可以在那里部署文件:
mvn deploy:deploy-file -DgroupId = me.soliveirajr -DartifactId = menta-regex -Dversion = 0.9.6-SNAPSHOT -Dpackaging = jar -Dfile = / path / to / file -Durl = [url] -DrepositoryId = [id]
Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=me.soliveirajr -DartifactId=menta-regex -Dversion=0.9.6-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
那么如何强制maven将SNAPSHOT版本下载到我的本地(.m2)存储库?
推荐答案
只需将其添加到〜/ .m2 / settings.xml:
Just add this to your ~/.m2/settings.xml:
<profiles>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
这篇关于如何从maven SNAPSHOT存储库下载SNAPSHOT版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!