It is the default configuration to directly obtain dependency packages from Maven public repository over the Internet. However, for Chinese software companies, access to these public warehouses is usually slow, which is even more impossible for software companies with strict management requirements that cannot directly access the internet. Maven projects can be configured to retrieve dependencies only from Maven private servers.
The previous article describes how to install nexus as a Maven private server. The following assumes that the Nexus service on the S1 server is used. Refer to the official documentation:
Http://www.sonatype.com/books/nexus-book/reference/config-sect-intro.html
There is a Maven project on the Development machine. Edit it first ~ /. M2/settings. xml.
<settings> <mirrors> <mirror> <!--This sends everything else to /public --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://S1:8081/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <!--Enable snapshots for the built in central repo to direct --> <!--all requests to nexus via the mirror --> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <!--make the profile active all the time --> <activeProfile>nexus</activeProfile> </activeProfiles></settings>
You only need to change S1 to your Nexus server address. If no custom repository exists in the Pom. xml file of your Maven project, you can use it. For example, run the MVN clean compile command to download the Pom. XML and jar packages from S1.
Note: Sometimes the latest snapshot has been deployed on nexus, but MVN clean compile does not take the latest version. In this case, you need to use the-u parameter to force the check.
MVN clean compile-u
If not, delete the local cache directory. In the Jenkins project, you can execute a command line before build, for example:
rm -rf /usr/share/tomcat7/.m2/repository/com/esri/carrier/nginx-factory/