配置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

目录
相关文章
|
6月前
|
Java 测试技术 Apache
【Maven】常用命令、插件管理、私服nexus
【Maven】常用命令、插件管理、私服nexus
|
Java Maven Android开发
【Maven学习】Nexus私服代理其他第三方的Maven仓库
一、背景 【Maven学习】Nexus OSS私服仓库的安装和配置http://blog.csdn.net/ouyang_peng/article/details/78793038 【Maven学习】Nexus OSS私服仓库的备份与迁移http://blog.csdn.net/ouyang_peng/article/details/78796215 通过前面的两篇博客,我们已经将Nexus搭建好并且迁移到了新的机房,现在我发现我们之前的Nexus私服服务器居然没有对第三方经常使用的JCenter等没有做代理。
8642 0
|
6月前
|
Java Maven 数据安全/隐私保护
19Maven - 搭建私服环境
19Maven - 搭建私服环境
20 0
|
8月前
|
Java Linux Maven
表弟使用nexus搭建Maven私服全过程(含所遇问题及解决方案)上
表弟使用nexus搭建Maven私服全过程(含所遇问题及解决方案)
74 0
|
8月前
|
Java Linux Maven
表弟使用nexus搭建Maven私服全过程(含所遇问题及解决方案)下
表弟使用nexus搭建Maven私服全过程(含所遇问题及解决方案)
224 0
|
11月前
|
缓存 Oracle Java
Maven私服Nexus搭建教程
私服是在局域网的一种特殊的远程仓库,目的是代理远程仓库及部署第三方构件。有了私服之后,当 Maven 需要下载jar包时,先请求私服,私服上如果存在则下载到本地仓库。否则,私服直接请求外部的远程仓库,将jar包下载到私服,再提供给本地仓库下载。
1990 0
|
Java 测试技术 Maven
Maven简介和安装(配置中央仓库和本地仓库,IDEA配置Maven)
Maven简介和安装(配置中央仓库和本地仓库,IDEA配置Maven)
Maven简介和安装(配置中央仓库和本地仓库,IDEA配置Maven)
|
网络协议 Java 应用服务中间件
使用Nexus搭建Maven私服
使用Nexus搭建Maven私服
2337 0
|
存储 缓存 Java
Maven私服基础使用
Maven私服搭建
836 0
|
Java Maven
配置maven集成nexus私服(十八)
1.配置maven集成nexus 1.1.配置maven集成enxus
146 0
配置maven集成nexus私服(十八)

推荐镜像

更多