This article introduces a detailed explanation of the installation and use of Nexus on Maven private server. I will share it with you. The details are as follows:
1. Installation
1.1 Install docker and speed up
yum update && yum install dockersudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{"registry-mirrors": ["https://y7u9p3i0.mirror.aliyuncs.com"]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker1.2 Install docker-compose
yum install epel-release && yum install python-pip && pip install docker-compose
1.3 Install nexus
Prepare nexus folder: mkdir -p /opt/docker/nexus-data && chown -R 200 /opt/docker/nexus-data
Write a description file
version: '2'services: feitian-nexus: image: sonatype/nexus3 volumes: - /opt/docker/nexus-data:/nexus-data ports: - "10000:8081"
Installation: docker-compose up -d
2. Use the private server library
2.1 Specify downloading dependency packages from Nexus repository
Specify the repository address in the project pom.xml file:
<repository> <repository> <id>hfcb</id> <url>http://192.168.1.223:10000/repository/hfcb/</url> </repository> </repository>
3. Packing
3.1 Publish the project to the Nexus repository
Modify settings.xml in the Maven installation directory and add the user name and password of the Nexus repository
<server> <id>hfcb</id> <username>admin</username> <password>admin123</password></server>
Specify the repository address in the project pom.xml file:
<distributionManagement> <snapshotRepository> <id>hfcb</id> <url>http://192.168.1.223:10000/repository/hfcb/</url> </snapshotRepository></distributionManagement>
Enter the project root directory and execute mvn deploy to publish the project to Nexus
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.