Appearance
Nexus 快速入门
环境准备
nexus | 10.0.0.74 | 2c2g |
---|
安装 nexus 环境
bash
#配置hosts解析
[root@10.0.0.74 ~]# mkdir -p /app/tools/
[root@10.0.0.74 ~]# tar xf nexus-3.13.0-01-unix.tar.gz -C /app/tools/
[root@10.0.0.74 ~]# ln -s /app/tools/nexus-3.13.0-01/ /app/tools/nexus
[root@10.0.0.74 ~]# ln -s /app/tools/nexus/bin/nexus /sbin/
[root@10.0.0.74 ~]# rpm -ivh jdk-8u351-linux-x64.rpm
[root@10.0.0.74 ~]# nexus start Starting nexus
WARNING: ************************************************************
WARNING: Detected execution as "root" user. This is NOT recommended!
WARNING: ************************************************************
Starting nexus
[root@10.0.0.74 ~]# nexus status nexus is running
WARNING: ************************************************************
WARNING: Detected execution as "root" user. This is NOT recommended!
WARNING: ************************************************************
nexus is running.
#查看端口
[root@10.0.0.74 ~]# ss -lntup
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:* users:(("chronyd",pid=666,fd=6))
udp UNCONN 0 0 [::1]:323 [::]:* users:(("chronyd",pid=666,fd=7))
tcp LISTEN 0 50 0.0.0.0:8081 0.0.0.0:* users:(("java",pid=55101,fd=870))
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=749,fd=5))
tcp LISTEN 0 1 127.0.0.1:46511 0.0.0.0:* users:(("java",pid=55101,fd=84))
tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=749,fd=6))
[root@10.0.0.74 ~]# cat /etc/hosts
#HOSTS解析
效果
修改setting.xml
bash
#修改setting.xml
vim /app/tools/apache-maven-3.9.6/conf/settings.xml
<?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">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>my-nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>my-nexus-snapshot</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://10.0.0.74:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://10.0.0.74:8081/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://10.0.0.74:8081/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
测试 mvn clena package
bash
[root@10.0.0.72 /var/lib/jenkins/workspace/hellotest]# mvn clean package
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 51.570 s
[INFO] Finished at: 2025-04-14T16:42:21+08:00
[INFO] ------------------------------------------------------------------------