欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

nexus配置maven私服

程序员文章站 2022-07-14 08:21:50
...

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 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私服

nexus配置maven私服
点进去之后修改Configuration(False改为True):
nexus配置maven私服

在这里搜索试试是否成功:
nexus配置maven私服
搜索出现下图列表即为成功:
nexus配置maven私服

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>
相关标签: nexus maven