I have installed nexus, and configured my settings.xml to use my local nexus as repository, however, it always tries to fetch artifact from repo1.maven.org fist and then 开发者_JAVA百科timeout before it goes to fetch from nexus.
You need to declare in settings.xml that Nexus is a mirror for the external repos, as documented in the Nexus book (which you should read).
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://nexushost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
We normally declare the repositories in the POM.xml:
<repositories>
<repository>
<id>internal</id>
<url>http://192.168.0.10:8084/nexus/content/repositories/public</url>
</repository>
<repository>
...
According to the docs, the info in your settings.xml is the "local" repository, meaning the M2_REPO copy in your hard drive. http://maven.apache.org/settings.html
Also, we set up Nexus as a mirror of external repos, thus you only declare these at the Nexus server.
In 2.2.1 and 3.0.3 the mirror is ignored in certain cases if you're using the -gs option to override the default and specify a customized global settings file. Make sure, there's a valid settings.xml around in conf.
精彩评论