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?
In the meanwhile, this problem no longer occurs.
javax.annotation:javax.annotation-api:jar:1.2
is now available on Maven central.I had to add the following the
pom.xml
to resolve this problem:depending on when you are viewing this, you should go to
https://maven.java.net/content/groups/public/javax/annotation/javax.annotation-api/
and check what is the latest version.javax.annotation-api.jar version 1.2 is published on the java.net maven repository @ https://maven.java.net
follow this link to search for version 1.2 :
https://maven.java.net/index.html#nexus-search;gav~javax.annotation~javax.annotation-api~1.2~~
you can instruct maven to fetch artifacts from java.net maven repository by adding it to the section of your pom.xml. e.g.