简体   繁体   中英

Nexus takes jar from maven central, not from 3rd party

We have a problem at our project, where the pom file of the downloaded jar is not correct. It does not contain a 1.0 tag. So what we did was installing our "corrected" pom file for that library and added is a 3rd party library to nexus.

The problem we are now facing is that it does not take the version that we added as a 3rd party library. In a similar case, when we deleted the file out of the maven central nexus repository, than it took the 3rd party library, and it did not try to fetch it again from maven central.

Now we did the same for a corrupted jar, but when we delete the jar in the openSAML nexus repository, instead of using the 3rd party library, it refetches it from the openSAML nexus repository and it does not take ours.

Does anyone have an idea to why it refetches it and does not take the 3rd party library?

Try this. Remove the jar form your local repository. Now go to maven settings and temporarily remove entry for openSAML repository. Now build your project, it will now download jar from 3rd party nexus repository [Note that project might fail to build if 3rd repository doesn't have all dependencies. Once new jar is downloaded, now you place the openSAML entry back to maven settings.

Edit:

If above option is not feasible then you can set ordering of repositories in such a manner that it checks in 3rd party repository first and then in other repositories. This would mean that it will go to other repositories only if jar is not available in 3rd party. Now the order in whichmaven checks repositories is the order in which they are written in settings.xml. Check this post: How to set order of repositories in Maven settings.xml This solution is scalable as you can simply share this settings.xml across the team and you are done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM