chr*_*tek 18 java maven-2 snapshot maven
所以我有一个项目依赖于另一个项目的快照版本.依赖是:
<dependency>
<groupId>org.oop</groupId>
<artifactId>oop</artifactId>
<version>0.9.9-SNAPSHOT</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
对于oop项目,我确实进行了"mvn clean deploy",因此快照版本应该位于maven中央存储库中的某个位置.但是当我进行mvn clean安装时,上面的快照依赖项无法解决,我得到了这个:
失踪:
1)org.oop:oop:jar:0.9.9-SNAPSHOT
尝试从项目网站手动下载文件.
然后,使用以下命令安装它:mvn install:install-file -DgroupId = org.oop -DartifactId = oop -Dversion = 0.9.9-SNAPSHOT -Dpackaging = jar -Dfile =/path/to/file
或者,如果您托管自己的存储库,则可以在那里部署文件:mvn deploy:deploy-file -DgroupId = org.oop -DartifactId = oop -Dversion = 0.9.9-SNAPSHOT -Dpackaging = jar -Dfile =/path/to/file -Durl = [url] -DrepositoryId = [id]
有没有办法让maven自动下载快照?我必须在这里遗漏一些东西.
EDIT1:在我的settings.xml上我有:
<server>
<id>sonatype-nexus-snapshots</id>
<username>XXXXXX</username>
<password>XXXXXX</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>XXXXXX</username>
<password>XXXXXX</password>
</server>
Run Code Online (Sandbox Code Playgroud)
EDIT2:
Joh*_*ine 21
只需将其添加到〜/ .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>
Run Code Online (Sandbox Code Playgroud)
sti*_*vlo 19
要更新快照,请尝试使用-U选项
-U,--update-snapshots Forces a check for updated
releases and snapshots on remote
repositories
Run Code Online (Sandbox Code Playgroud)
但是,你说:
我确实做了'mvn clean deploy',因此快照版本应该在maven中央存储库中的某个位置.
这是不可能的,你的快照正在其他地方.如果我mvn clean deploy
没有配置我的个人存储库,我得到:
部署失败:未在分配管理元素中的POM或-DaltDeploymentRepository = id :: layout :: url参数中指定存储库元素
要启用部署,可以将一些配置添加到pom.xml,例如:
<distributionManagement>
<!-- Publish versioned releases here -->
<repository>
<id>myrepo</id>
<name>My releases</name>
<url>http://nexus.mycompany.com/nexus/content/repositories/releases</url>
</repository>
<!-- Publish snapshots here -->
<snapshotRepository>
<id>myrepo</id>
<name>my snapshots</name>
<url>http://nexus.mycompany.com/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>myrepo</id>
<name>My Public Repository</name>
<url>http://nexus.mycompany.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
Tho*_*mas 19
Maven会尝试自动下载快照,实际上也是如此(正如您的错误所示).默认情况下,Maven将每天查找一次较新的快照版本,但您可以在快照存储库配置中更改该时间间隔(例如,在settings.xml中):
<updatePolicy>interval:5</updatePolicy>
Run Code Online (Sandbox Code Playgroud)
这将使maven每5分钟检查一次(如果你经常建立).或者,您可以使用-U
或--update-snapshots
选项,手动强制检查.
但是,它无法找到依赖关系.您可以发布快照依赖项的repo设置和工件配置吗?
是org.oop:oop:jar:0.9.9-SNAPSHOT
您的存储库中的 工件?
...所以快照版本应该在maven中央存储库中的某个位置.
不,不是.我试着查一查,但找不到它.Afaik,有一些升级机制,所以也许你的设置是错的.但通常,正如其他人已经说过的那样,你可以使用像Artifactory或Nexus这样的自己的存储库管理器.
归档时间: |
|
查看次数: |
35237 次 |
最近记录: |