nexus配置maven私服
程序员文章站
2022-07-14 08:21:50
...
maven私服-nexus
nexus官网下载地址
1. 解压(在linux某一目录下)
tar -zxvf nexus-2.12.0-01-bundle.tar.gz
解压完出现两个文件夹:nexus-2.11.2-03 sonatype-work
2.进入nexus-2.11.2-03文件的conf目录下:
cd nexus-2.11.2-03/conf
编辑查看文件:
vi nexus.properties
查看conf文件结构:
ll或者ls
编辑nexus脚本,配置RUN_AS_USER参数:
vi /usr/nexus/nexus-2.12.0-01/bin/nexus
参数如下:
# Set this to the root of the Nexus installation
NEXUS_HOME="/usr/local/nexus/nexus-2.12.0-01"(此地方)
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write into the Nexus installation directory.
# NOTE - This will set the user which is used to run the Wrapper as well as
# the JVM and is not useful in situations where a privileged resource or
# port needs to be allocated prior to the user being changed.
RUN_AS_USER=root(此地方)
3.查看开放端口号:
netstat -ntupl
8081端口改为8082端口:
nexus-2.12.0-01/conf/nexus.properties的8081端口修改为8082.(此步骤只因我开的8082端口,如果8081端口开过的,就不用改配置了)
4.启动nexus:
/usr/local/nexus/nexus-2.12.0-01/bin/./nexus start(stop 关闭)
5.打开浏览器:
在浏览器输入你的服务器地址(****:8082/nexus),点击右上角Log in
默认账号:admin和密码:admin123
可以使用冒号来定义对齐方式:
6.网页配置maven私服
点进去之后修改Configuration(False改为True):
在这里搜索试试是否成功:
搜索出现下图列表即为成功:
7.配置完成之后在maven文件的conf/Settings.xml中就可以把你的配置加载进去。如下配置:
<settings>
.......
<profiles>
<!--设置maven私库信息-->
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>releases</id>
<name>releases</name>
<url>http://*********:8082/nexus/content/repositories/releases</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>snapshots</id>
<name>snapshots</name>
<url>http://*******:8082/nexus/content/repositories/snapshots</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!--**私库信息的配置-->
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
推荐阅读
-
maven安装以及eclipse配置maven的方法
-
Nexus-在项目中使用Maven私服,Deploy到私服、上传第三方jar包、在项目中使用私服jar包
-
maven多仓库配置 公司仓库和阿里仓库
-
实测Maven上传jar包到私服的方法归纳
-
Maven安装和在IDEA配置Maven
-
多模块maven的deploy集成gitlab ci自动发版配置
-
Jenkins + Docker + dockerfile-maven-plugin + Harbor CI/CD spring-boot项目的最轻量级配置
-
多模块maven的deploy集成gitlab ci自动发版配置
-
将Android封装库通过gradle部署到maven私服并依赖使用
-
【maven的使用】1maven的概念与配置