2013-05-30 32 views
5

更新:這不會/不應再發生,請參閱接受的答案。如果您正在使用其他jar文件來解決這個問題,那通常是一件短暫的事情。您可以嘗試其他解決方法中提出的一些解決方法。我是Jersey 2.0 user guide。當我到了1.3(運行項目,我得到的失敗:遵循Jersey 2.0用戶指南時無法解析的依賴關係錯誤

[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文件能夠正確解析依賴關係嗎?

回答

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/和檢查什麼是最新的版本。

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的部分來從java.net maven存儲庫中獲取工件。例如

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

由於某種原因,我必須在查看搜索結果之前打開該鏈接兩次,但它的工作原理:)謝謝。 – pulkitsinghal