Build a Nexus Maven private server in CentOS 6.5
1. Download Nexus
**
: Http://www.sonatype.org/nexus/go
I used this version: nexus-2.14.3-02-bundle.tar.gz
**
2. decompress and start Nexus
**
1. Unzip the nexus-2.14.3-02-bundle.tar.gz
tar xvf nexus-2.14.3-02-bundle.tar.gz
2. decompress the package and generate two directories: nexus-2.14.3-02 and sonatype-work. The former contains the running environment and Applications of nexus, the latter contains your own configuration and data;
3. Start nexus
cd nexus-2.14.3-02/bin/./nexus start/stop/restart
** Note: The nexus root startup is abnormal: WARNING-not recommended to run as root solution modify the nexus under % nexus_home %/bin/TO # RUN_AS_USER = change TO RUN_AS_USER = root ** 4. visit: http: // 192.168.4.241: 8081/nexus/check the Nexus welcome page to verify that the Nexus is successfully started. log On As admin in the upper right corner. The default user name/password is admin/admin123.
**
3. Configure Maven and Nexus private servers
**
1. Replace the default Maven configuration file (settings. xml) with the following content:
<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <!-- id must be the same with pom.xml --> <id>release</id> <username>admin</username> <password>******</password> </server> <server> <!-- id must be the same with snapshotRepository section in pom.xml --> <id>snapshot</id> <!-- The username and password of the nexus server --> <username>admin</username> <password>******</password> </server> </servers> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://192.168.4.241:8081/nexus/content/groups/public/</url> </mirror> </mirrors></settings>
2. Two Local upload methods depend on the Nexus server: webpage upload and maven depoly. Add the following configuration to the project pom. xml:
<!-- For deploy your own maven jars --> <distributionManagement> <!-- Nexus Release Deploy Repository --> <repository> <id>release</id> <name>Nexus release repository</name> <url>http://192.168.4.241:8081/nexus/content/repositories/releases</url> </repository> <!-- snapshot repository --> <snapshotRepository> <id>snapshot</id> <name>Nexus Snapshot Deploy Repository</name> <url>http://192.168.4.241:8081/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement>
Note: The id must be the same as the id in settings. xml.
After the configuration is complete, you can introduce the dependency locally to check whether the private server generates the corresponding jar package.