maven将项目打包上传到nexus * 的详细教程
作者:tiguer 时间:2023-04-18 16:20:22
1、pom.xml文件添加distributionManagement节点。
模块项目中如果存在父子项目,且父子项目的jar包都需要上传到 * 的话,直接在父项目pom文件中添加这段配置,如果只需要将子项目jar包上传 * ,则在子项目的build标签同级添加这段配置。
<!-- 使用分发管理将本项目打成jar包,直接上传到指定服务器 -->
<distributionManagement>
<!--正式版本-->
<repository>
<!-- nexus服务器中用户名:在settings.xml中<server>的id-->
<id>releases</id>
<!-- 这个名称自己定义 -->
<name>Releases</name>
<url>http://192.168.4.49:9999/repository/maven-releases/</url>
</repository>
<!--快照版本-- >
<snapshotRepository>
<id>snapshots</id>
<name>Snapshot</name>
<url>http://192.168.4.49:9999/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
2、pom文件中< repository >节点下的< id >对应maven的配置文件setting.xml文件中的server的id,两者必须保持一致才能生效。
<!--maven连接nexus需要验证用户名和密码-->
<servers>
<server>
<id>releases</id>
<username>dev</username>
<password>dev</password>
</server>
<server>
<id>snapshots</id>
<username>dev</username>
<password>dev</password>
</server>
<servers>
3、注意上传到 * 的是正式版本还是快照版本,正式版本在pom.xml文件version中不能有SNAPSHOT,快照版本才有。
<groupId>com.apic</groupId>
<artifactId>ind-goods-biz</artifactId>
<version>0.0.1.RELEASE</version>
<!-- <version>0.0.1-SNAPSHOT</version> -->
4、在idea中点击右侧工具栏中的maven,再选择maven弹出框中的m标识,选择对应的项目,执行mvn clean deploy,将项目打包发布到 * 。
来源:https://blog.csdn.net/tiguer/article/details/107655811
标签:maven,打包上传,nexus, ,
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
SpringBoot Aop 详解和多种使用场景解析
2022-10-02 12:03:47
![](https://img.aspxhome.com/file/2023/4/73124_0s.png)
SpringBoot整合第三方技术的详细步骤
2023-11-29 08:22:48
![](https://img.aspxhome.com/file/2023/7/60777_0s.png)
linux下C语言中的mkdir函数与rmdir函数
2023-07-07 14:16:16
Java学习-打印1-1000以内的水仙花数代码实例
2023-05-02 03:58:45
解决mybatis三表连接查询数据重复的问题
2023-09-13 15:24:25
![](https://img.aspxhome.com/file/2023/2/105912_0s.jpg)
java中多个@Scheduled定时器不执行的解决方法
2023-03-19 02:32:34
详解Java高级特性之反射
2021-06-09 14:01:06
linux下idea、pycharm等输入中文拼音时满3个字母后无法继续拼音输入的问题
2022-03-03 20:49:19
![](https://img.aspxhome.com/file/2023/8/64408_0s.png)
C# WinForm-Timer控件的使用
2023-11-20 06:54:00
![](https://img.aspxhome.com/file/2023/7/92837_0s.png)
springboot2.3 整合mybatis-plus 高级功能(图文详解)
2022-10-19 20:04:05
![](https://img.aspxhome.com/file/2023/6/121926_0s.png)
SpringBoot实现本地存储文件上传及提供HTTP访问服务的方法
2022-09-14 19:09:12
![](https://img.aspxhome.com/file/2023/9/63749_0s.png)
Android调用系统摄像头拍照并显示在ImageView上
2022-02-19 17:42:00
![](https://img.aspxhome.com/file/2023/5/104685_0s.png)
详解springboot项目带Tomcat和不带Tomcat的两种打包方式
2023-11-28 08:23:41
Java Springboot的目的你知道吗
2022-12-20 14:16:24
C#中Foreach循环遍历的本质与枚举器详解
2022-08-04 05:31:12
![](https://img.aspxhome.com/file/2023/9/108699_0s.png)
全面解析Android应用开发中Activity类的用法
2022-03-11 00:48:53
![](https://img.aspxhome.com/file/2023/3/137863_0s.png)
SpringBoot利用切面注解及反射实现事件监听功能
2022-09-25 16:55:00
![](https://img.aspxhome.com/file/2023/9/96829_0s.png)
springBoot项目如何实现启动多个实例
2021-09-22 00:13:47
![](https://img.aspxhome.com/file/2023/0/70500_0s.png)
Java之OutputStreamWriter流案例详解
2023-11-11 13:03:55
java获取时间的方法总结
2022-03-28 15:36:38