【问题标题】:Unresolved dependencies error when following Jersey 2.0 user guide遵循 Jersey 2.0 用户指南时出现未解决的依赖项错误
【发布时间】:2013-05-25 14:56:27
【问题描述】:

更新:这不会/不应再发生,请参阅已接受的答案。如果您在使用其他 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 文件中放入什么才能正确解决该依赖关系?

【问题讨论】:

    标签: java maven jersey pom.xml


    【解决方案1】:

    同时,此问题不再发生。 javax.annotation:javax.annotation-api:jar:1.2 现在是 available on Maven central

    【讨论】:

      【解决方案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/ 并查看最新版本。

      【讨论】:

        【解决方案3】:

        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 存储库中获取工件。例如

        <repositories>
            <repository>
                <id>java.net.repo</id>
                <url>https://maven.java.net/content/groups/promoted/</url>
                <layout>default</layout>
            </repository>
        </repositories>
        

        【讨论】:

        • 由于某种原因,我必须打开该链接两次才能看到搜索结果,但它可以工作:) 谢谢。
        猜你喜欢
        • 2023-03-16
        • 2021-12-15
        • 1970-01-01
        • 2020-12-25
        • 2016-09-14
        • 1970-01-01
        • 2012-10-15
        • 2012-03-30
        • 2017-01-11
        相关资源
        最近更新 更多