Reputation: 15314
I'm on my work machine, and our team pulls artifacts from a corporate repository. I'm trying to pull
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.18.1</version>
</dependency>
and for whatever reason, maven is not searching any public repositories. To my POM, I've added:
<repositories>
<repository>
<id>java.net</id>
<url>https://maven.java.net/content/repositories/public/</url>
</repository>
</repositories>
As suggested by hellboy, there is a mention of my corporate repository in the settings.xml file:
<mirror>
<id>artifactory</id>
<mirrorOf>*</mirrorOf>
<url>http://corporate-network-domain/nexus/content/groups/public</url>
<name>Artifactory</name>
</mirror>
my understanding was that this configuration means that when Maven attempts to retrieve artifacts, it will search the repository specified in the settings.xml file, followed by the repo specified in the POM file. Is there something that I'm mistaken on?
there appears to be the suggestion that the tag < mirrorOf> directs all traffic to the corporate network and the solution lies here: http://maven.apache.org/guides/mini/guide-mirror-settings.html
However, I'm still reading and trying to understand what to do. Solution which indicates how to search the corporate repo first then the public next, provided below will be rewarded!
Upvotes: 0
Views: 406
Reputation: 5174
The mirror setting in settings.xml says:
Take every URL of every repository and replace it with the mirror, thus no request leave your company. This is usually as it should be. If you really want to bypass your artifact repository, you can exclude certain repositories:
<mirror>
<id>artifactory</id>
<mirrorOf>external:*,!java.net</mirrorOf>
<url>http://corporate-network-domain/nexus/content/groups/public</url>
<name>Artifactory</name>
</mirror>
(By the way, you should use external:*
instead of *
, because the latter could introduce some hard to trace effects during integration testing)
Note that this might violate company conventions. There is usually a reason for not allowing direct access to repositories "in the wild".
The better way would be, as Seelenvirtuose suggested, to request your artifactory admin to include the java.net repository in the proxied repositories of your artifactory.
Upvotes: 0
Reputation: 20618
In our company we have the same mirroring entry in our settings.xml as you have. Additionally, you should add a repository profile as explained in the Sonatype Nexus Book. With that settings you do not need to specify any repositories, neither in the settings nor in any POM.
What you then do is configure the already existing public repository group in Nexus:
In the configuration for a repository of type group you can add and remove repositories as you wish:
The shown repositories are proxy repos that you also must add to Nexus before. The central repo - for example - is added as a default in a Nexus installation.
Upvotes: 0
Reputation: 2252
check if you have following lines in your settings.xml-
<mirrors>
<mirror>
<id>someid</id>
<name>corporate</name>
<url>corporate repo url</url>
<mirrorOf>external:*,!someid,!someid2</mirrorOf>
</mirror>
</mirrors>
This block will force all the search to "corporate repo url" when it does not find the artifact in the resource url as defined within profiles someid and someid2
Upvotes: 1