Maven基础配置—上传jar包到私服
2016-01-17 16:02
357 查看
一、配置
在需要上传的工程中的pom.xml文件中加入下面的配置<distributionManagement>
<repository>
<id>release</id>
<name>Release Repository</name>
<url>http://ip/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshot</id>
<name>Snapshot Repository</name>
<url>http://ip/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
我们可以在settings.xml中配置全局的url地址,pom.xml中进行动态获取。
settings.xml的default-profile中加入下面全局配置
<properties>
<ReleaseRepository>http://ip/nexus/content/repositories/releases</ReleaseRepository>
<SnapshotRepository>http://ip/nexus/content/repositories/snapshots</SnapshotRepository>
</properties>
pom.xml中改为
<distributionManagement>
<repository>
<id>release</id>
<name>Release Repository</name>
<url>${ReleaseRepository}</url>
</repository>
<snapshotRepository>
<id>snapshot</id>
<name>Snapshot Repository</name>
<url>${SnapshotRepository}</url>
</snapshotRepository>
</distributionManagement>
这样,pom.xml中就可以动态获取settings.xml中的地址
除此之外,还要在settings.xml中配置鉴权账号,否则上传将报401鉴权错误
<server>
<id>deployment</id>
<username>deployment</username>
<password>deployment账号的密码</password>
</server>
二、命令
mvn deploy:deploy-file -DgroupId=groupId -DartifactId=artifactId -Dversion=version -Dfile=本地jar包路径 -DrepositoryId=releases/snapshots -Durl=仓库地址举例:上传jmxri-1.2.1.jar,本地存放在D盘
mvn deploy:deploy-file -DgroupId=com.sun.jmx –DartifactId=jmxri -Dversion=1.2.1 -Dfile=d:/jmxri-1.2.1.jar -DrepositoryId=releases -Durl=http://ip/nexus/content/repositories/releases
相关文章推荐
- ssh免密码登录
- 简单谈谈lua和c的交互
- OSG学习笔记一:搭建最简单的环境
- 广播的实现--实现强制下线功能
- 从CVPR 2014看计算机视觉领域的最新热点
- 012-httpd2.4(CentOS 7) new features config
- C++操作文本
- codevs 1690 开关灯 线段树水题
- HTTP和SOAP完全就是两个不同的协议
- op07-SELinux op
- Spring2.5学习3.3_@Autowire注解实现手动装配
- linux 文件夹操作
- hdu2161 Primes
- 编译PHP中的扩展时遇到的问题及解决方法
- JavaScript框架继承写法
- python使用yield来减少内存开销
- Matlab中使用文本文件(.txt)进行数据存取的技巧总结(1)
- Integer valueOf
- 哈希表和二叉树?
- 一天结束后,如何复盘?