簡體   English   中英

遵循Jersey 2.0用戶指南時未解決的依賴項錯誤

[英]Unresolved dependencies error when following Jersey 2.0 user guide

更新:這不會/不應該再發生,請參閱接受的答案。 如果您遇到其他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等等

pom本身沒有任何直接引用這個注釋jar。 所以我想問題是:我如何調整這種依賴? 我在POM文件中放入什么才能正確解析依賴關系?

同時,這個問題不再發生。 javax.annotation:javax.annotation-api:jar:1.2現在可以在Maven central上使用

我不得不添加以下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/並查看最新版本。

javax.annotation-api.jar 1.2版發布在java.net maven repository @ 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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM