1、Nexus安装
百度云链接 : https://pan.baidu.com/s/1EIHLg0Ynt8OWNPgPhK4jyw
提取码:aabs
//-----文件夹目录-----
mkdir /usr/local/nexus
//-----解压-----
tar -zxvf nexus-3.9.0-01-unix.tar.gz
//-----设置端口号-----
vi /nexus-3.9.0-01/etc/nexus-default.properties
application-port=8081
//-----勿用ROOT账户启动,启动异常-----
useradd nexus
chown -R nexus:nexus nexus/
//-----nexus用户启动-----
su nexus
cd nexus/nexus-3.9.0-01/bin/
./nexus run
Nexus-run.png
打开浏览器访问 :http://localhost:8081
- 账户:admin
-
密码 : admin123
Nexus-1.png
2、Nexus仓库
- 代理仓库:需要修改代理服务地址http://maven.aliyun.com/nexus/content/groups/public/
Nexus-proxy.png
- 仓库组:可以统一管理多个仓库
Nexus-group.png
- 创建仓库
Nexus-create.png
3、整合Springboot
- 配置本地Maven Settings文件
<servers>
<!-- id为nuxus私库标识; username与password为nexus等账号信息 -->
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>admin-release</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>admin-snapshot</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<profiles>
<profile>
<id>mycof</id>
<repositories>
<!-- 私有库地址配置 -->
<repository>
<id>nexus</id>
<!-- url 指向nexus的group -->
<url>http:// #ip :8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<!-- 插件库地址 -->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http:// #ip :8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>jdk-1.8</activeProfile>
<activeProfile>mycof</activeProfile>
</activeProfiles>
- 配置pom.xml文件
<distributionManagement>
#id 需要和 setting文件中的id相同
<repository>
<id>admin-release</id>
<url>http:// #ip :8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>admin-snapshot</id>
<url>http:// #ip :8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
-
点击deploy开始构建
image.png
4、异常解决 or 优化
-
1.must be "pom" but is "jar"
在parent工程的pom.xml中加入
<packaging>pom</packaging>
-
2.登录后出现警告
Nexus-warning.png
#编辑
vi /etc/security/limits.conf
nexus soft nofile 65536
nexus hard nofile 65536
- 2.内存优化
#编辑Nexus启动需要的内存
vi /nexus-3.9.0-01/bin/nexus.vmoptions
-Xms128M
-Xmx128M
-XX:MaxDirectMemorySize=256M