nexus配置maven私服

来源:互联网 发布:pmi指数知乎 编辑:程序博客网 时间:2024/05/21 19:33

maven私服-nexus

nexus官网下载地址

http://www.sonatype.org/nexus/archived/

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 installationNEXUS_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>
原创粉丝点击