0

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?

Quirexx
  • 173
  • 3
  • 15
  • Just a comment... when you do fixes like uploading a pom or whatever you are effectively creating a new release and as such should change the GAV coordinates and upload a whole new set and not just add a patched file to the repo... – Manfred Moser Oct 16 '13 at 17:27

1 Answers1

0

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.

Community
  • 1
  • 1
Lokesh
  • 7,810
  • 6
  • 48
  • 78
  • Do you mean delete the repository from the pom file? It does not contain repository, but goes straight to the nexus. Your comment made me think about putting out the service, and then it takes the jar from the 3rd party repository. But when I put it back on it takes it again from the openSAML. So putting the service out (and then back in) is only a solution when the jar is already in the local repository. This is not a open solution for multiple developers (because we will have to shut down the openSAML repository service evertime, someone needs to pull in all dependencies locally. – Quirexx Oct 10 '13 at 15:05
  • Not from pom. Just check the settings.xml of your Maven deployment, it will have entries for repositores to use to download artifacts, just remove it from there temporarily. Also remember a dependency will be downloaded only if its missing in local repository. – Lokesh Oct 10 '13 at 15:08
  • I appreciate the idea, but it is a bit unpractical in a large team, because people come and go at the project, so it is not efficient to remove and add the repository from the settings (or put the repository out of service) everytime someone does not have it in his local repository. It is just weird that the maven central repository does not refetch, but the openSAML repository does. – Quirexx Oct 10 '13 at 15:19
  • Yes it has been solved now. Also want to point out that you can change the order of the repositories in your nexus. – Quirexx Oct 11 '13 at 12:41
  • I assume you tried the approach mentioned in the link i posted or is there any other way to change ordering of repositories? – Lokesh Oct 11 '13 at 12:51
  • In nexus you can do sorting in group: http://books.sonatype.com/nexus-book/reference/confignx-sect-managing-groups.html – Quirexx Oct 11 '13 at 14:00