1. Set up Nexus private server
Environment preparation:
OS:
[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
JDK Installation
Download address:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
tar -xzf jdk1.8.0_121.tar.gz mkdir /usr/java mv jdk1.8.0_121 /usr/java echo 'JAVA_HOME=/usr/java/jdk1.8.0_121' >>/etc/profile echo 'export PATH=$PATH:$JAVA_HOME:$JAVA_HOME/bin' >>/etc/profile source /etc/profile
Nexus Installation
Download address:https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.5-02-bundle.zip
wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.5-02-bundle.zip unzip nexus-2.14.5-02-bundle.zip mv nexus-2.14.5-02-bundle /usr/local/nexus
Nexus Start
/usr/local/nexus/bin/nexus start
Access address when up: http://host IP:8081 Default password: admin admin123
Note: If port 8081 is occupied, it will not start.If the port is up and inaccessible, close the firewall or open the port
Close firewall: systemctl stop firewalld
Development Port: * firewall-cmd --add-port=8081/tcp --permanent; firewall-cmd --reload
Nexus private warehouse has
Group group combines other private warehouses, such as public unified external warehouse addresses
hosted local private repository stores third-party jar packages (if oracle drives jar)
proxy Forward Private Warehouse Download jar package to Central Warehouse
virtual Warehouse
Create User
* Select Nexus user to create user
2. Maven ConfigurationSetting.xml
Note: Download Maven to download it yourselfHttp://maven.apache.org/(Setting.xmlOften store conf/maven home directories locallySetting.xmlOr m2. /Setting.xmlThese two locations
<?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"> <localRepository>D:\commons\apache-maven-repos</localRepository> <servers> <server> <id>gpdi</id> <username>gpdi</username> <password>gpdi333</password> </server> </servers> <mirrors> <!-- <mirror> <id>aliyun</id> <mirrorOf>*</mirrorOf> <name>aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> --> <mirror> <id>gpdi</id> <mirrorOf>gpdi333</mirrorOf> <name>gpdi</name> <url>http://192.168.147.128:8081/nexus/content/groups/public/</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>io.spring.repo.maven.release</id> <url>http://repo.spring.io/release/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>io.spring.repo.maven.milestone</id> <url>http://repo.spring.io/milestone/</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>gpdi</id> <name>gpdi</name> <url>http://192.168.147.128:8081/nexus/content/groups/public/</url> <layout>default</layout> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings>
3. IDE Call Private Warehouse Pom.xml To configure
Add <distribution management>to <project></project>
<project> ... <distributionManagement> <repository> <id>gpdi</id> <name>release</name> <url>http://192.168.147.128:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>gpdi</id> <name>snapshots</name> <url>http://192.168.147.128:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> ... </project>
Note: The ID of the repository should matchSetting.xmlConfiguration is consistent.
Configured above, check IDE for use if there is a maven deploy "return code 401" error in the IDESetting.xmlIs the file configuredSetting.xml
For example: IDEA
File --> setting Choose ConfiguredSetting.xmlThen click OK.Redeploy
At this time, the installation and configuration of the nexus, maven,ide development environment has been completed. If you have any questions, please leave a message.