In the case of in-house development, it is generally used as a central repository. and the official library domestic connection speed is very slow, download speed of only 0 points a few K per second, people are very mad, use Nexus can also establish a central library mirror.
I. Installation of Nexus
Nexus Official Website: Http://www.sonatype.com/nexus/product-overview
Nexus Download Address: Http://www.sonatype.org/nexus/go
This software is divided into several versions: Nexus OSS, Nexus Pro, Nexus pro+, etc. The Nexus OSS contains basic warehouse management functionality, which is free of charge, and the remaining versions are licensed for purchase.
1, download Nexus
cd /tmp
wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-latest-bundle.zip
unzip nexus-latest-bundle.zip
mv nexus-2.11.4-01 /home
cd /home/nexus-2.11.4-01/
Will extract the nexus-2.11.4-01 directory.
2. Execute script
There are several directories under the NEXUS-2.11.4-01 directory:
LICENSE.txt NOTICE.txt Bin conf lib logs Nexus TMP
There is a script named Nexus in the Bin directory.
How to use:
Usage: ./nexus { console | start | stop | restart | status | dump }
Perform:
./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.
3, access to the Administration page
Browser input: http://IP:8081/nexus/
This startup is run using an inline jetty bundle, and the server needs to install the JDK. Jetty is a container that runs a JSP, servlet, and is similar to Tomcat.
User name: admin
Password: admin123
The port number can be modified within the nexus.properties in the Conf directory.
Second, the configuration warehouse
1, open the remote index
We want to sync the official Central Library, first to open the remote index, download the index file.
1) Click Repositories
2 Select the type as proxy of the three libraries Apache snapshots, the Codehaus snapshots
3 Set the download Remote indexes to True
4) in the Apache Snapshots,codehaus snapshots and the three warehouses respectively right, select Repari Index
PS: Only the Central Library downloads the index file successfully, and the other two libraries are not published state ...
2. Health Check
Click on the Green analyze
Third, the project configuration
Increase in the pom.xml of the project:
<repositories> <repository> <id>my-maven</id> <name>My Maven</name> <url>http://IP:8081/nexus/content/repositories/central/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots>
This allows dependency packs to be downloaded from the Central Library mirror when the dependency pack is locally acquired.