Kinjal Dixit Kinjal Dixit - 7 months ago 14
Java Question

Unresolved dependencies error when following Jersey 2.0 user guide

Update: This does not/should not occur anymore, see accepted answer. If you are facing this problem with some other jar, it is typically a transient thing. You can try some of the workaround suggested in other answers.

I am following the instructions from Jersey 2.0 user guide. When I reach 1.3 (running the project, I get the following failure:

[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


The problem seems to be that there is no
https://maven.java.net/content/groups/public/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar


If we go up to
https://maven.java.net/content/groups/public/javax/annotation/javax.annotation-api/
we see that the folders and jar files inside those folders are renamed with a suffix of
-b01
etc.

The pom itself does not have any direct reference to this annotations jar. So I guess the question is: How do I adjust that dependency? What do I put in the POM file that will get that dependency resolved correctly?

Answer

In the meanwhile, this problem no longer occurs. javax.annotation:javax.annotation-api:jar:1.2 is now available on Maven central.

Comments