We cannot get a project to pull from a remote repository using mvn package. In maven installed folder, config/settings.xml we declare our internal central repo:
<mirrors>
<mirror>
<id>advnexus</id>
<mirrorOf>*</mirrorOf>
<url>http://internalserver/nexus/content/groups/public</url>
</mirror>
</mirrors>
This works for all of the jar files hosted at this repo. But we have some additional jar files we pushed to a server under our control and running Sonatype Nexus. So in the project's pom.xml, we setup our remote repo as:
<repositories>
<repository>
<id>companynamenexus</id>
<name>Company Name Project Repo</name>
<url>http://nexus.companyname.com:8081/repository/project-name</url>
<layout>default</layout>
<spanshots>
<enabled>false</enabled>
</spanshots>
</repository>
</repositories>
When I run the build, it pulls any needed jar files from the main repo, but simply times out trying to pull the jar files that don't exist on this repo vs. using the repository in the pom.xml.
Note that in the settings.xml mirror section, I tried changing the <mirrorOf>
to be central vs. *, but this just caused additional errors.
I have also tried setting up this repo as a secondary mirror in the settings.xml, tried commenting out the mirror in the settings.xml and place it as an additional repository in the pom.xml, all without finding the right combination. Seems like a simple problem, but the answer is eluding us.
Best solution: Don't try to access two different internal Nexus, but set up a repository group in one of the Nexus that contains all other repositories (may they be hosted or proxy, internal or external). Then you can simply set a mirror entry on that repository group and you are fine.
Second best solution: Change your mirror entry to <mirrorOf>*,!companynamenexus</mirrorOf>
and define the additional repository in the <repositories>
section of your settings.xml
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With