搭建Maven私服Nexus(CentOS版)
发布日期:2021-06-29 19:40:27 浏览次数:2 分类:技术文章

本文共 1603 字,大约阅读时间需要 5 分钟。

1、下载Nexus

https://www.sonatype.com/download-oss-sonatype

2、解压Nexus

上传到/usr/local/nexus文件夹下面,

解压 tar -zxvf nexus-3.14.0-04-unix.tar.gz

3、配置Nexus服务

$ cd /usr/local/nexus$ ln -s nexus-3.14.0-04 nexus$ vim /etc/profile

PATH后面添加

.PATH:/usr/local/nexus-3.14.0-04/bin

在最后面添加

export NEXUS_HOME=/usr/local/nexus/nexus-3.14.0-04

 

使新加入的内容生效

$ source /etc/profile

4、启动Nexus服务

cd /usr/local/nexus/nexus-3.14.0-04/binnexus start或者./nexus start

5、访问Nexus

地址:http://localhost:8081,用户名admin,密码admin123,

6、修改端口号

修改配置文件/usr/local/nexus-3.14.0-04/etc/nexus-default.properties

application-port=8181

重启服务

./nexus restart

7、配置hosted类型Nexus仓库

修改Hosted为Allow redeploy

单击Create repository按钮,创建仓库。

8、增加到maven-public仓库

9、修改maven配置文件
在settings.xml中增加server和mirror配置:

<server>

      <id>dahua</id>
      <username>dahua</username>

      <password>******</password>

</server>

<mirror>

  <id>dahua</id>
  <mirrorOf>*</mirrorOf>
  <url>http://www.xadhsd.com:8181/repository/maven-public/</url>
</mirror>

10、修改pom.xml配置文件

在pom.xml中增加repository配置:

<repositories>  

<repository>  
<id>dahua</id>  
<name>DaHua Repository</name>  
<url>http://www.xadhsd.com:8181/repository/maven-public/</url>  
</repository>  
</repositories>  
<pluginRepositories>  
<pluginRepository>  
<id>dahua</id>  
<name>DaHua Repository</name>  
<url>http://www.xadhsd.com:8181/repository/maven-public/</url>  
</pluginRepository>  
</pluginRepositories>  

11、上传jar包

mvn deploy:deploy-file -DgroupId=com.test.cn -DartifactId=test -Dversion=1.0 -Dpackaging=jar -Dfile=D:\test.jar -Durl=http://www.xadhsd.com:8181/repository/dahua/ -DrepositoryId=dahua

或者使用界面上传:

12、修改密码

先输入旧密码,如下图所示:

再输入新密码,如下图所示:

注意:动作要快,不然修改失败。

参考:

 

转载地址:https://daqiang.blog.csdn.net/article/details/85275752 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Spring Boot引用jar包报错:Consider defining a bean of type '***' in your configuration
下一篇:CentOS安装gitblit

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月29日 20时01分51秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章