maven从nexus下载构件以及maven部署构件到nexus的配置

1、maven从nexus下载构件的配置

1.1、在项目pom中配置远程仓库(方式一)

<repositories>
    <repository>
        <id>remote</id>
        <name>my nexus repository</name>
        <url>http://192.1.1.103:8081/nexus/content/groups
                 /public/</url>
    </repository>
</repositories>
<pluginRepositories>
        <pluginRepository>
            <id>nexus</id>
            <name>Nexus</name>
            <url>http://192.1.1.103:8081/nexus/content/groups
                    /public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
</pluginRepositories>

1.2、或者在setting.xml中以镜像形式配置远程仓库(方式二)

这样就不需要每个项目都配置一次

<mirrors>
  <mirror>
       <id>remote</id>
       <name>remote</name>
       <url>http://192.1.1.103:8081/nexus/content/
               repositories/central/</url>
       <mirrorOf>*</mirrorOf>
  </mirror>
</mirrors>

<mirrorOf>*</mirrorOf> 这句话意思是所有构件都会从私服中下载

1.3、或者在setting中配置<profile>标签(方式三)

<profiles>
    <profile>
        <id>dev</id>
        <repositories>
            <repository>
                <id>nexus</id>
                <name>Nexus</name>
                <url>http://192.1.1.103:8081/nexus/content/groups
                         /public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>public</id>
                <name>Nexus</name>
                <url>http://192.1.1.103:8081/nexus/content/groups
                        /public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
             </pluginRepository>
        </pluginRepositories>
    </profile>
   </profiles>
   <!-- 激活私服 --><activeProfiles>
    <activeProfile>dev</activeProfile>
</activeProfiles>

2、maven部署构件到nexus的配置

2.1、项目pom中配置

    <distributionManagement>
        <repository>
            <id>releases</id>
            <name>nexus release</name>
                <url>http://192.1.1.103:8081/nexus/content/
                         repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>nexus snapshot</name>
                <url>http://192.1.1.103:8081/nexus/content/
                         repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

2.2、setting.xml中配置

  <servers>
    <server>
             <id>releases</id>
             <username>deployment</username>
             <password>deployment123</password>
     </server>
     <server>
             <id>snapshots</id>
             <username>deployment</username>
             <password>deployment123</password>
     </server>

  </servers>

2.3、maven命令

mvn deploy

本文作者:hjjay
原文出处:https://www.cnblogs.com/jayhou/p/12271566.html
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接。

原文地址:https://www.cnblogs.com/jayhou/p/12271566.html

时间: 2024-07-30 10:20:31

maven从nexus下载构件以及maven部署构件到nexus的配置的相关文章

配置Maven从私服下载构件

--------------------siwuxie095 配置 Maven 从私服下载构件 从 Nexus 私服下载构件的配置方法共有三种 1.法一: 在 pom.xml 的 project 标签中添加如下内容 <repositories> <repository> <id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/gr

使用Maven部署构件至私服

--------------------siwuxie095 使用 Maven 部署构件至私服 1.部署构件到 Nexus 私服分两种情况: (1)日常开发生成的快照版本构件可以直接部署到 Nexus 私服 的宿主仓库 Snapshots 中 (2)项目最终生成的发布版本构件可以直接部署到 Nexus 私服 的宿主仓库 Releases 中 2.具体配置分如下两步: (1)第一步:在 pom.xml 的 project 标签中添加如下内容 <distributionManagement> &l

使用 Maven 部署 artifact 到 Nexus 教程

本文侧重讲解如何将已经按照好的 Maven 和 Nexus 连接,即如何通过 Maven 部署 artifact 到 Nexus. 本文前提: 1. 安装好 Maven.可以使用 Maven 创建.打包项目.关于安装 2. 安装好 Nexus.可以访问本地的 Nexus 仓库 http://localhost:8081/nexus/#welcome . 正文: 1. 配置 Maven 的配置文件 settings.xml 和 项目的说明文件 pom.xml ,使得 Maven 知道往哪里部署 ,

解决nexus下载maven索引的问题

解决nexus下载maven索引的问题 (2011-10-12 17:48:46) 转载▼ 标签: it 分类: java 转自 http://www.colorfuldays.org/program/fix_update_index_onnexus/ 下载这个文件http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.zip真困难啊,本地幸亏有apache 在上个周五在公司的一台服务器上用nexus搭建了maven r

Maven部署构件至远程仓库

私服的一大作用就是部署第三方构件,包括组织内的生成的构件以及一些无法从外部仓库获取的构件.无论是日常开发中生成的构件,还是正式版本发布的构件,都需要部署到仓库中,供其它团队成员使用.Maven除了能对项目进行编译.测试.打包之外,还能将项目生成的构件部署到仓库中.我们可以在pom.xml中配置构件的部署地址. distributionManagement包含repository和snapshotRepository子元素,前者表示发布版本构件的仓库,后者表示快照版本的仓库.往远程仓库部署构件的时

有关使用Maven常见问题总结(Eclipse中使用Maven、Maven项目部署到tomcat等问题)

最近一些项目需要让Maven来管理,一种情况是将之前的eclipse的Java Project项目和Web project 加入Maven管理,还有一种情况是,将SVN上的Maven项目拉到本地,在eclipse中使用时遇到的一些棘手问题,问题过程和解决具体方案如下: 1.在eclipse中安装maven插件后启动eclipse时,会遇到如下警告: The Maven Integration requires that Eclipse be running in a JDK, because a

用nexus搭建自己的maven私有仓库

用nexus搭建自己的maven私有仓库 刚安装nexus时,nexus启动失败,启动不到1分钟,自动停止.后来查找到了原因: Java 6 Support EOLOracle's support for Java 6 ended in February 2013.  Consequentially as of version 2.6 Nexus now requires a Java 7 JRE to run. 意思就是从2.6.0开始不支持6了,jdk版本要求7以上. 一.用admin用户登

nexus 的使用及maven的配置

一.nexus的安装 1.下载nexus(点解这里) 2.下载后解压文件,将解压后的nexus文件放在你自己想要的地方 3.配置环境变量(和配置java的环境变量一样) 4.安装和启动nexus 由于我已经安装和启动过nexus,所以有错误信息提示 5.启动成功后,在浏览器输入http://localhost:8081/nexus/就会进入nexus的操作界面 我们也可以在conf/nexus.properties修改端口 6.用admin登录成功后,可以看到如下界面 我们可以看见type有多重

配置Nexus仓库,部署构件到Nexus仓库

上一节,我们讲述了如何配置安装nexus系统,这节,我们来介绍nexus的使用 1.登录 在红色的部分点击登陆,输入用户名和密码 admin/admin123. 这里可以配置nexus系统,管理用户,管理角色,管理任务,查看系统Rss源以及查看系统日志,本文就介绍nexus最基本的用法. 2.代理maven中央仓库 点击右边菜单栏的Repositories,界面的主面板会显示所有一个所有仓库及仓库组的列表,你会看到它们的type, type类型字段里有group,hosted,proxy,vir