Maven 未下载快照
我正在尝试使用位于本地网络中的存储库设置 Maven,并且我已经设置了一个用于快照的存储库和一个用于发布的存储库(均为 apache archiva)。
从发布存储库下载软件包效果很好。但是,当我尝试从快照存储库加载快照版本时,当我尝试下载我自己部署的快照时,我不断收到错误:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) my.company:product2:jar.lastUpdated:0.0.2-SNAPSHOT
Try downloading the file manually from the project website.
[...]
Path to dependency:
1) my.company:product1:war:0.0.1-SNAPSHOT
2) my.company:product2:jar.lastUpdated:0.0.2-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
my.company:product1:war:0.0.1-SNAPSHOT
from the specified remote repositories:
my-internal (http://my-repo:8080/archiva/repository/internal),
central (http://repo1.maven.org/maven2),
my-snapshots (http://my-repo:8080/archiva/repository/snapshots),
该包在快照存储库中可用,网络已启动,登录工作正常。
我的 pom.xml 如下所示:
[...]
<repositories>
<repository>
<id>my-snapshots</id>
<name>my name Snapshots Repository</name>
<url>http://my-snapshots:8080/archiva/repository/snapshots</url>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
</repository>
<repository>
<id>my-internal</id>
<name>my name internal Repository</name>
<url>http://my-repo:8080/archiva/repository/internal</url>
</repository>
</repositories>
[...]
<dependency>
<groupId>my.company</groupId>
<artifactId>frontend-api</artifactId>
<version>0.0.2-SNAPSHOT</version>
<type>jar.lastUpdated</type>
</dependency>
[...]
我还检查了从快照存储库下载的 maven-metadata.xml:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>my.company</groupId>
<artifactId>product2</artifactId>
<version>0.0.2-SNAPSHOT</version>
<versioning>
<snapshot>
<buildNumber>7</buildNumber>
<timestamp>20090824.130209</timestamp>
</snapshot>
<lastUpdated>20090824130209</lastUpdated>
</versioning>
</metadata>
它显示了正确的日期和时间戳(存储库中存在包含此时间戳的包)。
我是否遗漏了有关存储库设置或快照概念的内容?有人遇到同样的问题吗?或者有人知道有关快照和存储库的一些详细文档吗?
I am trying to set up Maven with a Repository located in our local Network and I already have set up a Repository for snapshots and one for Releases (both apache archiva).
Downloading the packages from the release repository works fine. However I keep getting errors, when I try to load SNAPSHOT versions from the snapshot repository, when I try to download a SNAPSHOT I deployed myself:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) my.company:product2:jar.lastUpdated:0.0.2-SNAPSHOT
Try downloading the file manually from the project website.
[...]
Path to dependency:
1) my.company:product1:war:0.0.1-SNAPSHOT
2) my.company:product2:jar.lastUpdated:0.0.2-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
my.company:product1:war:0.0.1-SNAPSHOT
from the specified remote repositories:
my-internal (http://my-repo:8080/archiva/repository/internal),
central (http://repo1.maven.org/maven2),
my-snapshots (http://my-repo:8080/archiva/repository/snapshots),
The package is available in the snapshots-repo, network is up, login works fine.
My pom.xml looks like this:
[...]
<repositories>
<repository>
<id>my-snapshots</id>
<name>my name Snapshots Repository</name>
<url>http://my-snapshots:8080/archiva/repository/snapshots</url>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
</repository>
<repository>
<id>my-internal</id>
<name>my name internal Repository</name>
<url>http://my-repo:8080/archiva/repository/internal</url>
</repository>
</repositories>
[...]
<dependency>
<groupId>my.company</groupId>
<artifactId>frontend-api</artifactId>
<version>0.0.2-SNAPSHOT</version>
<type>jar.lastUpdated</type>
</dependency>
[...]
I checked also the maven-metadata.xml that was downloaded from the snapshot-repo:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>my.company</groupId>
<artifactId>product2</artifactId>
<version>0.0.2-SNAPSHOT</version>
<versioning>
<snapshot>
<buildNumber>7</buildNumber>
<timestamp>20090824.130209</timestamp>
</snapshot>
<lastUpdated>20090824130209</lastUpdated>
</versioning>
</metadata>
It shows the correct date and timestamp (a package containing this timestamp is present in the repo).
Am I missing something concerning the repository setup or the SNAPSHOT concept? Did anybody had the same problem? Or does somebody know about some detailed documentation about SNAPSHOTs and Repositories?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
my-app 的依赖声明是什么样的?我希望它看起来像这样:
从错误来看,它看起来像是由原型生成的并添加了 lastUpdated 类型。如果是这种情况,删除 lastUpdated 应该可以解决问题。
如果不是这样,您能分享一下您的 POM 部分吗?
有关 Maven SNAPSHOT 版本的更多信息,请参阅 Maven 书籍:
因此,通常不需要 lastUpdated 属性。
What does the dependency declaration for my-app look like? I'd expect it to look like this:
From the error, it looks like it has been generated by an archetype and added the lastUpdated type. If that is the case removing lastUpdated should resolve the issue.
If that's not the case, can you share the section of your POM please?
For more information on Maven SNAPSHOT versions, see the Maven book:
The lastUpdated property is therefore not typically needed.
使用 -e 标志运行 mvn 以获取更详细的错误消息。
Run the mvn with the -e flag for more detailed error messages.
你的settings.xml 文件怎么样?
如果你的pom xml有以下内容:
那么setting.xml应该有类似的内容:
1)存储库用户名和密码必须如上
2)settings和pom中的id标签必须相同:
What about your settings.xml file?
if your pom xml has the following:
then the setting.xml should have something like:
1) The repository username and password must be as above
2) The id tag in both settings and pom must be the same: