参考1:
https://www.cnblogs.com/xiaomaomao/p/14172062.html
参考2:
https://www.linuxidc.com/Linux/2017-03/141230.htm
前提:
- 安装jdk
-
软件下载
- 我这里的安装包的版本是 nexus-2.14.14-01-bundle.tar ,使用命令解压安装包
tar -zxvf nexus-2.14.14-01-bundle.tar - 可能会报错,报上面错误时:需要修改运行的用户,修改运行文件 nexus,命令:vim nexus,将RUN_AS_USER修改为root;
- 看启动日志
./nexus console - 启动
./nexus start - 访问
http://xxx:8081/nexus
密码:admin/admin123
- 几个默认库的说明:
maven-central:maven中央库,默认从https://repo1.maven.org/maven2/拉取jar
maven-releases:私库发行版jar
maven-snapshots:私库快照(调试版本)jar
maven-public:仓库分组,把上面三个仓库组合在一起对外提供服务,在本地maven基础配置settings.xml中使用。
新建私有仓库
-
刚创建nexus时候需要新建仓库:
- 创建仓库
-
release仓库
-
snapshot仓库
配置
- 项目pom配置
<distributionManagement>
<snapshotRepository>
<id>hippiusSnapshot</id>
<url>http://129.211.xx.xxx:8081/nexus/content/repositories/hippiusSnapshot</url>
</snapshotRepository>
<repository>
<id>hippiusRelease</id>
<url>http://129.211.xx.xxx:8081/nexus/content/repositories/hippiusRelease</url>
</repository>
</distributionManagement>
- 修改好版本号
<groupId>xxx</groupId>
<artifactId>xxx</artifactId>
<version>1.1.1-SNAPSHOT</version>
- maven setting配置
<server>
<id>hippiusSnapshot</id>
<username>xx</username>
<password>xx</password>
</server>
<server>
<id>hippiusRelease</id>
<username>xx</username>
<password>xx</password>
</server>
- 该配置可不要
<profiles>
<profile>
<id>devProfile</id>
<repositories>
<repository>
<id>hippiusRelease</id>
<name>hippius product release</name>
<url>http://129.211.xx.xx:8081/nexus/repository/hippiusRelease/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>hippiusSnapshot</id>
<name>hippius product snapshot</name>
<url>http://129.211.xx.xx:8081/nexus/repository/hippiusSnapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!-- activeProfiles
| List of profiles that are active for all builds.
| -->
<activeProfiles>
<activeProfile>devProfile</activeProfile>
</activeProfiles>
- 上传命令
mvn clean -Dmaven.springboot.skip=true deploy -
查看
5.创建用户,赋权参考
https://www.cnblogs.com/del88/p/11994592.html