Maven 无法解析它刚刚找到的依赖关系
Maven一定是疯了。
我使用 Netbeans 添加依赖项对话框添加了依赖项。我搜索了jax-rs-ri
。它更新了中央索引并显示了 jax-rs-ri
的多个版本。我选择了 1.9.1
并将其添加到 pom.xml
中:
<dependency>
<groupId>com.sun.jersey.ri</groupId>
<artifactId>jax-rs-ri</artifactId>
<version>1.9.1</version>
</dependency>
看起来不错,但是当我构建时出现以下错误:
Failed to execute goal on project reply-to.test-web:
Could not resolve dependencies for project jms:reply-to.test-web:war:1.0-SNAPSHOT:
Could not find artifact com.sun.jersey.ri:jax-rs-ri:jar:1.10-b03 in
central (http://repo1.maven.org/maven2) -> [Help 1]
我也尝试更改存储库以下具有相同的结果:
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
</repositories>
这在今天早些时候有效。 Maven 刚刚出了什么问题吗?
Maven must be losing its mind.
I added a dependency using Netbeans Add Dependency dialog. I searched for jax-rs-ri
. It updated the index from central and showed several versions of jax-rs-ri
. I selected 1.9.1
and it added this to the pom.xml
:
<dependency>
<groupId>com.sun.jersey.ri</groupId>
<artifactId>jax-rs-ri</artifactId>
<version>1.9.1</version>
</dependency>
Looks right, but when I build I get the following error:
Failed to execute goal on project reply-to.test-web:
Could not resolve dependencies for project jms:reply-to.test-web:war:1.0-SNAPSHOT:
Could not find artifact com.sun.jersey.ri:jax-rs-ri:jar:1.10-b03 in
central (http://repo1.maven.org/maven2) -> [Help 1]
I've also tried changing the repository the following with the same results:
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
</repositories>
This was working earlier today. Did something just get broken with Maven?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这些情况下,值得检查本地存储库(通常为
c:\Users\\.m2\repository\com\sun\jersey\ri\jax-rs-ri
或/home/<用户名>/.m2/repository/com/sun/jersey/jax-rs-ri
)和中央:http://search .maven.org/#artifactdetails|com.sun.jersey.ri|jax-rs-ri|1.9.1|pom
(现在重要的部分是“可用下载”表。)
因此,没有任何
jar
文件,只有一个zip
(和 POM)。您应该在依赖项中使用zip
,如下所示:由于它是 zip,因此您可能想要解压它。这个答案可能会有所帮助: 在 maven 中解压依赖项
请注意
1.9.1 不是最新的 jax-rs-ri
版本,并且您的 Maven 使用1.10-b03
。如果您想强制它使用1.9.1
,您必须在dependency< 内使用
[1.9.1]
/代码> 标签。In these cases it's worth to check the local repository (usually
c:\Users\<username>\.m2\repository\com\sun\jersey\ri\jax-rs-ri
or/home/<username>/.m2/repository/com/sun/jersey/jax-rs-ri
) and Central:http://search.maven.org/#artifactdetails|com.sun.jersey.ri|jax-rs-ri|1.9.1|pom
(The important part now is the "Available Downloads" table.)
So, there isn't any
jar
file just azip
(and the POM). You should use<type>zip</type>
in your dependency like this:Since it's a zip maybe you want to unpack it. This answer could help: Unzip dependency in maven
Please note that
1.9.1
is not the latestjax-rs-ri
version and your Maven uses1.10-b03
. If you want to force it to use1.9.1
you have to use<version>[1.9.1]</version>
inside thedependency
tag.