更新:这不会/不应再发生,请参阅接受的答案。如果您在使用其他 jar 时遇到此问题,这通常是暂时的。您可以尝试其他答案中建议的一些解决方法。
我正在按照Jersey 2.0 用户指南中的说明进行操作。当我达到 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
etc。
pom 本身没有任何直接引用此注释 jar。所以我想问题是:我如何调整这种依赖关系?我在 POM 文件中放了什么才能正确解决该依赖关系?