maven自动打包上传nexus仓库配置
一个基础类,可能要升级并放到私服库里,为了方便,应该能够自动打包放到nexus。这就需要配置maven一些参数与pom.xml。
依次在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>
- </servers>
- ...
- <!-- 引用naxus倉庫組-->
- <profile>
- <id>dev</id>
- <repositories>
- <repository>
- <id>nexus</id>
- <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>nexus</id>
- <url>http://127.0.0.1:8081/nexus/content/groups/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- ..
- <!-- nexus -->
- <activeProfiles>
- <activeProfile>dev</activeProfile>
- </activeProfiles>
注意:根據標籤位置準確輸入
在本项目的pom.xml配置即可
<!--上传配置 必须-->
<distributionManagement>
<repository>
<id>releases</id>
<url>http://127.0.0.1:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://127.0.0.1:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<!--上传source.jar 非必须-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
上面的ID和pom.xml中对应distributionManagement-> repository的ID,用户名和密码需要在nexus中配置。
完成以上配置,只要输入命令:mvn deploy 即可。
遇到的问题:
maven deploy到nexus报错:Return code is: 401, ReasonPhrase:Unauthorized
提交到nexus时候报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project *: Failed to deploy artifacts: Could not transfer artifact *:jar:1.0 from/to releases (http://10.1.81.199:8081/nexus/content/repositories/releases/): Failed to transfer file:http://10.1.81.199:8081/nexus/content/repositories/releases/com/cs2c/security-management-client* /1.0/*-1.0.jar. Return code is: 401, ReasonPhrase:Unauthorized.
原来是没有配置认证。
maven目录conf的setting.xml里,
- <server>
- <id>releases</id>
- <username>admin</username>
- <password>admin123</password>
- </server>
- <server>
- <id>snapshots</id>
- <username>admin</username>
- <password>admin123</password>
- </server>
- </servers>
用户名和密码都是nexus的。再次deploy即可。
注意这里的id要和pom.xml里远程deploy的地址对应一致,我的pom.xml里配置:
- <!-- 配置远程发布到私服,mvn deploy -->
- <distributionManagement>
- <repository>
- <id>releases</id>
- <name>Nexus Release Repository</name>
- <url>http://10.1.81.199:8081/nexus/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>snapshots</id>
- <name>Nexus Snapshot Repository</name>
- <url>http://10.1.81.199:8081/nexus/content/repositories/snapshots/</url>
- </snapshotRepository>
- </distributionManagement>
maven自动打包上传nexus仓库配置的更多相关文章
- Maven 自动打包上传到私服 Nexus
转载于:http://blog.csdn.net/jerome_s/article/details/54410178 Maven获取jar的默认顺序是
- Maven配置jar(war)包自动打包上传Maven服务器的配置
Maven配置jar(war)包自动打包上传Maven服务器的配置 创建jar(war)包工程 创建一个maven工程 在工程中穿件一个测试类 配置pom.xml <distributionMa ...
- iOS开发进阶 - 使用shell脚本自动打包上传到fir.im上-b
用fir.im测试已经好长时间了,感觉每次打包上传都很麻烦,想着是不是可以用脚本自动打包,在网上搜了一下确实有,下面总结一下如何使用脚本自动打包上传到fir.im,以及打包过程中遇到的问题和解决办法 ...
- 如何将maven项目打包上传到私服
比如我们想要把项目通过maven生产源码包和文档包并发布到自己的私服上,有两个maven插件可以做到这些工作,一个是maven-source-plugin,另一个是maven-javadoc-plug ...
- 使用shell脚本自动打包上传 fir.im
http://blog.csdn.net/wang631106979/article/details/52299083
- xcodebuild自动打包上传到蒲公英的shell脚本
注意: ExportOptions.plist (包含了证书相关信息) 该plist 文件可以通过xcode手动导出ipa之后获取到, 区分appstore 和 development的情况 #! / ...
- Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):4、Maven项目转换与pom.xml配置
文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...
- Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):3、Maven独立插件安装与settings.xml配置
文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...
- Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1、JIRA账号注册
文章目录: Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):1.JIRA账号注册 Taurus.MVC-Java 版本打包上传到Maven中央仓库(详细过程):2.PGP ...
随机推荐
- <<架构漫谈>>读后感
今天按照老师的要求,看了架构漫谈1--9讲,觉得受益良多,以下是我得点点读后感: (一)什么是架构? 架构的英文是Architecture,从定义上看,架构好像是一个过程,也不是很清晰.下面从架构的缘 ...
- 用户模拟+spec
用户模拟:用户模拟的对象分别为小学二年级学生,学生父亲以及小学教师. 名字 孔小颖 性别 男 职业 小学生 收入 来自父母给予 知识层次和能力 小学二年级 生活/工作情况 在学校上课,数学成绩较差,放 ...
- numpy行转列
>>> a = np.array([1, 2, 3]) >>> a = a.reshape(-1, 1) #-1表示任意行数,1表示1列 >>> ...
- git学习笔记——廖雪峰git教程
OK,先附上教程--廖雪峰的官方网站 友情连接:git官网 简介 这里我只想引用他的原文: Linus可以向BitMover公司道个歉,保证以后严格管教弟兄们,嗯,这是不可能的.实际情况是这样的: L ...
- shell脚本--循环结构
shell的循环结构有while和for两种 for循环 #!/bin/bash #文件名:test.sh i=4 for i in 2 4 6 8 10 do echo $i done echo $ ...
- CAS的应用场景
国外应用(需FQ尝试): 来自CAS官网推荐的Demo http://casserver.herokuapp.com/cas/login https://casserver.herokuapp.com ...
- jQuery中click事件多次触发解决方案
jQuery 中元素的click事件中绑定其他元素的click事件. 因为jQuery中的click事件会累计绑定,导致事件注册越来越多. 解决方案: 1.能够避开,避免把click事件绑定到其他元素 ...
- python删除数组元素导致跳过元素
复现的情况大概可以写成这样 abc = [1, 2, 2, 3, 4] print abc for index, i in enumerate(abc): if i == 2: del abc[ind ...
- Linux基础学习(7)--用户和用户组管理
第七章——用户和用户组管理 一.用户配置文件 1.用户信息文件/etc/passwd: (1)用户管理简介:所以越是对服务器安全性要求高的服务器,越需要建立合理的用户权限等级制度和服务器操作规范. ...
- 在保存Bitmap的时候出现“GDI出现一般性错误”
今天开发的时候出现过一个非常奇怪的问题,在保存最终的Bitmap图片的时候,明明使用Directory.Exist(filePath)函数判断当前路径的时候,这些路径都是有用的并且都是合法的,但是就是 ...