配置maven集成nexus私服(十八)

简介: 1.配置maven集成nexus1.1.配置maven集成enxus

1.配置maven集成nexus

1.1.配置maven集成enxus

1.修改maven配置文件
[root@jenkins ~]# vim /etc/maven/settings.xml
#找到 <servers> 标签,添加 Nexus 默认认证信息:132行下面粘贴
  <server>
    <id>my-nexus-releases</id>
    <username>admin</username>      #nexus的账号
    <password>admin123</password>   #nexus的密码
  </server>
  <server>
    <id>my-nexus-snapshot</id>
    <username>admin</username>      #nexus的账号
    <password>admin123</password>   #nexus的密码
  </server>
  </servers>
#找到 <mirrors> 标签,添加镜像:168行下面粘贴
  <mirror>
  <!--This sends everything else to /public -->
  <id>nexus</id>
  <mirrorOf>*</mirrorOf>  
  <url>http://192.168.81.210:8081/repository/maven-public/</url>    #nexus中maven-public的地址,在4里面有指导怎么找
  </mirror>
#找到 <profiles> 标签,添加仓库信息:262行下面粘贴
  <profile>
    <id>nexus</id>
    <!--Enable snapshots for the built in central repo to direct -->
    <!--all requests to nexus via the mirror -->
    <repositories>
      <repository>
        <id>central</id>
        <url>http://192.168.81.210:8081/repository/maven-public/</url>    #nexus中maven-public的地址,在4里面有指导怎么找
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
      </repository>
    </repositories>
   <pluginRepositories>
      <pluginRepository>
        <id>central</id>
        <url>http://192.168.81.210:8081/repository/maven-public/</url>    #nexus中maven-public的地址,在4里面有指导怎么找
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
      </pluginRepository>
    </pluginRepositories>
  </profile>
#激活仓库:293行下面粘贴
<activeProfiles>
  <!--make the profile active all the time -->
  <activeProfile>nexus</activeProfile>
</activeProfiles>

1.2.maven编译java项目查看是否是nexus的地址

[root@jenkins helloworld]# mvn package
会看到把需要的jar包都会缓存到nexus的

在去页面上看browse—maven-public就会有jar包

2.集成nexus前后对比

2.1.集成前编译需要11.79s

2.2.集成后编译需要2.84s

目录
相关文章
|
Java Shell 程序员
解决:bash: syntax error near unexpected token `(‘ ...【亲测有效】
解决:bash: syntax error near unexpected token `(‘ ...【亲测有效】
9971 0
|
网络协议 Docker 容器
Docker的4种网络模式
我们在使用docker run创建Docker容器时,可以用--net选项指定容器的网络模式,Docker有以下4种网络模式: · host模式,使用--net=host指定。
8811 0
|
网络安全 Docker 容器
docker启动容器时报错:iptables: No chain/target/match by that name
【已解决】docker启动容器时报错:iptables: No chain/target/match by that name
9701 2
|
存储 弹性计算 缓存
阿里云通用算力型u1实例规格介绍(实例特点、适用场景、指标数据)
阿里云在2022金秋云创季活动中新增了一个通用算力型u1实例规格的云服务器,这是最新产品,本文介绍云服务器ECS通用算力型实例规格族的特点,并列出了具体的实例规格。
1002 0
阿里云通用算力型u1实例规格介绍(实例特点、适用场景、指标数据)
|
SQL 缓存 Java
修改PostgreSQL字段长度导致cached plan must not change result type错误
修改PostgreSQL字段长度可能导致cached plan must not change result type错误
9112 0