With maven, I occasionally hit an artifact that comes from some 3rd-party repo that I haven't built or included in my repository yet.
I'll get an error message from the maven client saying that an artifact can't be found:
Failure to find org.jfrog.maven.annomojo:maven-plugin-anno:jar:1.4.0 in
http://myrepo:80/artifactory/repo
was cached in the local repository, resolution will not be reattempted until the update interval of MyRepo has elapsed or updates are forced -> [Help 1]
Now, I understand what this means, and can simply re-run my command with -U
, and things usually work fine from there on out.
However, I find this error message to be extremely unintuitive and am trying to spare my co-workers some headaches.
I am trying to figure out if there is some place that I can modify this update interval
setting.
- Is the
update interval
that is mentioned in this error message a client-side or server-side setting? - If client-side, how do I configure it?
- If server-side, does anyone know how/if Nexus/Artifactory expose these settings?
I used to solve this issue by deleting the corresponding failed to download artifact directory in my local repo. Next time I run the maven command the artifact download is triggered again. Therefore I'd say it's a client side setting.
Nexus side (server repo side), this issue is solved configuring a scheduled task. Client side, this is done using
-U
, as you already pointed out.You need to delete all "_maven.repositories" files from your repository.
This error can sometimes be misleading. 2 things you might want to check:
Is there an actual JAR for the dependency in the repo? Your error message contains a URL of where it is searching, so go there, and then browse to the folder that matches your dependency. Is there a jar? If not, you need to change your dependency. (for example, you could be pointing at a top level parent dependency, when you should be pointing at a sub project)
If the jar exists on the remote repo, then just delete your local copy. It will be in your home directory (unless you configured differently) under .m2/repository (ls -a to show hidden if on Linux).
Somewhat relevent.. I was getting
This error was caused by accidentally using
Maven 3
instead ofMaven 2
. Just figured it might save someone some time, because my initial google search led me to this page.If you use Nexus as a proxy repo, it has "Not Found Cache TTL" setting with default value 1440 minutes (or 24 hours). Lowering this value may help (Repositories > Configuration > Expiration Settings).
See documentation for more info.
What basically happens is,According to default updatePolicy of maven.Maven will fetch the jars from repo on daily basis.So if during 1st attempt your internet was not working then it would not try to fetch this jar again untill 24hours spent.
Resolution :
Either use
where -U will force update the repo
or use
in your settings.xml