I am using versions-maven-plugin to automatically find latest release/snapshot versions of maven artifacts, found in many different nexus repositories.

It seems like the plugin is using the maven-metadata-$REPO.xml (where $REPO is id for a repository) files in my local repository to find the latest version of an artifact.

I often need to mvn:release an artifact, and just right after that, I need to update another artifact depending on the just released artifact, but versions-maven-plugin cannot find it because it's latest version is listed in those xml files, even though it actually exists in nexus.

I hope some of you can come with ideas as to how I can solve the problem. Thanks for your time.

1

There are 1 answers

0
matt5784 On

Maven caches the status of artifacts for a certain amount of time (if you've ever had an artifact download fail and seen it say that it wouldn't try again until a certain amount of time had passed, this is part of that functionality). So if it checks the repository for an artifact it won't check again for new versions every single time you try to use it, it remembers for a while and then will check again after some time has passed.

However, if you rename/delete (rename at first to be safe/so you don't lose it) the metadata file it will have no choice but to re-download the new metadata file (since it needs it and the repo is the only place for it to find it) and then when it looks at the new file it will see the new versions of your artifact and download those too.