配置maven访问nexus,配置项目pom.xml以发布maven项目到nexus中
maven访问nexus有三种配置方法,分别为:
项目pom.xml,优先级最高;
user的settings.xml,优先级中,未在pom.xml中配置repository标签,则使用这个配置;
maven的settings.xml,优先级最低,在项目pom.xml和user的settings.xml都没有配置仓库时,才使用这个配置;
项目pom.xml配置,在pom.xml中添加以下内容:
<repositories>
<repository>
<id>public</id>
<name>public</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>public</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
以上仓库配置也可以在maven用户的setting.xml文件中(注意localhost应为设计的ip地址或url),如下:
<profiles>
<profile>
<id>ourRepositoryGroup</id>
<repositories>
<repository>
<id>public</id>
<name>public</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>public</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories> </profile>
</profiles> <activeProfiles>
<activeProfile>ourRepositoryGroup</activeProfile>
</activeProfiles>
关注maven配置文件的优先级,简单的做法是让其保持一致。
以上配置了访问Nexus的Public Repositories仓库组,id和name都无关紧要,要紧的是url必须适配。

发布项目到Nexus,在pom.xml中添加以下内容:
<!-- 发布项目到Nexus -->
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
带源码发布的插件配置,在pom.xml中添加以下内容:
<build>
<plugins>
<!-- 发布源码,需要这个插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
发布需要nexus登录
在user的settings.xml
<!--配置nexus仓库认证信息 -->
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
配置maven访问nexus,配置项目pom.xml以发布maven项目到nexus中的更多相关文章
- Maven项目pom.xml配置详解
maven项目pom.xml文件配置详解,需要时可以用作参考: <project xmlns="http://maven.apache.org/POM/4.0.0" xmln ...
- 关于导入本地maven项目pom.xml出现missing artifact org....报错处理
一.导入本地maven项目步骤:
- Maven项目pom.xml文件简单解析
Maven项目pom.xml简单解析 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="h ...
- maven项目pom.xml第一行报错
maven项目pom.xml第一行报错 这是第一行:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi= ...
- java maven项目 pom.xml plugin 报错, build path 找不到 jconsole-1.8.0.jar 和 tools-1.8.0.jar 包
maven项目pom.xml突然报错,在Java Build Path 中并没有引用的jar包出现在了Maven Dependencies的依赖包中. 这个错误直接导致了pom.xml文件中 < ...
- 在idea中打开maven项目pom.xml未识别
在idea中打开maven项目pom.xml没有识别出来,导致idea不能自动下载依赖包, 解决办法是选中pom.xml文件,右键-" add as maven project"
- IDEA Maven项目 pom.xml 找不到 Dependency 依赖
转载: IDEA Maven项目 pom.xml 找不到 Dependency 依赖 如果你的pom.xml中使用了dependencyManagement管理依赖并且添加了你本地仓库中不存在的依赖可 ...
- maven项目解决pom.xml头部 http://maven.apache.org/xsd/maven-4.0.0.xsd报错的问题
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/qq_36611526/article/d ...
- Maven简介(五)——pom.xml
6 Maven的pom.xml介绍 6.1 简介 pom.xml文件是Maven进行工作的主要配置文件.在这个文件中我们可以配置Maven项目的groupId.artifactId ...
随机推荐
- [转][CentOS]开机时
来自:https://www.cnblogs.com/jcblog/p/6431252.html 在 CentOS 开机界面有两个菜单: 第一个选项正常启动,第二个选项急救模式启动(系统出项问题不能正 ...
- STM32 f407 温湿度采集报警
软件 keil5 实现 1.使用stm32f407中的DS18B20传感器采集空气温度 2.使用stm32f407中的DHT11传感器采集空气的温度和湿度 3.显示到stm32f407的LCD液晶显示 ...
- sys.modules[__name__]的一个实例
关于sys.modules[__name__]的用法,百度上阅读量比较多得一个帖子是:https://www.cnblogs.com/robinunix/p/8523601.html 对于里面提到的基 ...
- python面向对象 : 抽象类(接口类),多态,封装(私有制封装)
一. 抽象类(接口类) 与java一样, python也有抽象类的概念但是同样需要借助模块实现,抽象类是一个特殊的类, 它的特殊之处在于只能被继承, 不能被实例化. 从设计角度去看, 如果类是从现实对 ...
- VMware上centos系统忘记账号和密码解决
转载: https://blog.csdn.net/wyx_wyl/article/details/78246907 我们有时会忘记虚拟机上的登陆密码,今天来说一下怎样修改我们的密码.应该对大多数的l ...
- Java基础:IO流之字节流和字符流
1. 流的概念 流(stream)的概念源于UNIX中管道(pipe)的概念.在UNIX中,管道是一条不间断的字节流,用来实现程序或进程间的通信,或读写外围设备.外部文件等. 一个流,必有源端和目的端 ...
- log4net 配置允许同时写日志到同一个文件
RollingFileAppender appender = new RollingFileAppender();... appender.LockingModel = new FileAppende ...
- POJ K-th Number
[题解] 数据结构采用线段树.通过将数组的每一段归并排序来建树.将数组排序来实现离散化. 时间复杂度分析:建树的过程就是归并排序,其时间复杂度为O(nlog(n)).查询时:二分查找第k小元素的复杂度 ...
- 用Python进行人脸识别
本文的模型使用了C++工具箱 dlib 基于深度学习的最新人脸识别方法,基于户外脸部数据测试库Labeled Faces in the Wild 的基准水平来说,达到了99.38%的准确率. dlib ...
- 获取图片src
用jquery获取图片src(不知道为什么总是undefined): $('img').eq(i).src; $('img').eq(i).attr('src'); //上面两种都是获取不到,不知道为 ...