更新:这不会/不应该再发生,请参阅接受的答案。如果您遇到其他jar的问题,通常是暂时的。您可以尝试其他答案中建议的一些解决方法。
我按照Jersey 2.0 user guide的说明操作。当我达到1.3(运行项目时,我得到以下失败:
[ERROR] Failed to execute goal on project xxx-service: Could not resolve dependencies for project xxx.restapi:xxx-service:jar:1.0-SNAPSHOT: Failure to find javax.annotation:javax.annotation-api:jar:1.2 in https://maven.java.net/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of snapshot-repository.java.net has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
问题似乎是没有https://maven.java.net/content/groups/public/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar
如果我们前往https://maven.java.net/content/groups/public/javax/annotation/javax.annotation-api/
,我们会看到这些文件夹中的文件夹和jar文件被重命名,后缀为-b01
等。
pom本身没有任何对这个注释jar的直接引用。所以我想问题是:我如何调整这种依赖?我在POM文件中放入什么才能正确解析依赖关系?
答案 0 :(得分:3)
同时,这个问题不再发生。 javax.annotation:javax.annotation-api:jar:1.2
现在是available on Maven central。
答案 1 :(得分:2)
我必须添加以下pom.xml
来解决此问题:
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2-b04</version>
</dependency>
取决于您何时查看此内容,您应该转到https://maven.java.net/content/groups/public/javax/annotation/javax.annotation-api/
并查看最新版本。
答案 2 :(得分:1)
javax.annotation-api.jar 1.2版发布在java.net maven资源库@ https://maven.java.net
点击此链接搜索1.2版:
https://maven.java.net/index.html#nexus-search;gav~javax.annotation~javax.annotation-api~1.2~~
你可以通过将它添加到pom.xml的部分来指示maven从java.net maven存储库中获取工件。 e.g。
<repositories>
<repository>
<id>java.net.repo</id>
<url>https://maven.java.net/content/groups/promoted/</url>
<layout>default</layout>
</repository>
</repositories>