maven上传jar到nexus私服仓库
2016-05-20 10:42
453 查看
1通过网页上传
这种方法只是上传了jar包。通过maven引用当前jar,不能取得jar的依赖
from pom的方式,选择pom文件,以及jar。通过maven引入jar时,会自动加载jar的依赖
2通过maven的方式depoly
在maven的conf/setting.xml 配置nexus私服的管理账号在servers标签下添加server
<server> <id>nexus-snapshots</id> <username>repouser</username> <password>repopwd</password> </server>
id可自己定义一个名称 以及私服的管理管的账号密码
在mirrors和profiles下配置nexus私服
<mirrors> <mirror> <!--This sends everything else to /public --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://192.168.10.8:18080/nexus/content/repositories/releases/</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <!--Enable snapshots for the built in central repo to direct --> <!--all requests to nexus via the mirror --> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://192.168.10.8:18080/nexus/content/groups/public</url> <releases><enabled>true</enabled><updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy></releases> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>local private nexus</name> <url>http://192.168.10.8:18080/nexus/content/groups/public</url> <releases><enabled>true</enabled><updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy></releases> <snapshots><enabled>false</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <!--make the profile active all the time --> <activeProfile>nexus</activeProfile> </activeProfiles>
在项目的pom.xml中配置
<distributionManagement> <repository> <id>nexus-releases</id> <name>Nexus Release Repository</name> <url>http://192.168.10.8:18080/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>nexus-snapshots</id> <name>Nexus Snapshot Repository</name> <url>http://192.168.10.8:18080/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
id与settings.xml中的server的id对应
当项目package后
mvn deploy
就可以将jar上传到nexus私服
3利用命令行
mvn deploy:deploy-file -DgroupId=javax.el -DartifactId=javax.el-api -Dversion=2.2.4 -Dpackaging=jar -Dfile=D:\Users\WEIJIA625\Desktop\javax.el-api-2.2.4.jar-Durl=http://127.0.0.1:8081/nexus/content/groups/public -DrepositoryId=central
相关文章推荐
- 基姆拉尔森计算公式(计算某天是星期几的模板)
- LeetCode 42. Trapping Rain Water(装雨水)
- 图片热点,网页划区,form表单
- linux 安装一些命令
- 【MySQL】查看当前存储引擎
- 自我总结-KMP算法
- 个人学习-java-枚举
- spring+mybatis 框架搭建
- caffe学习笔记(3):solver层配置
- Eclipse在包内建立子包
- 记录我在华为的经历----阿冬专栏
- 关于 失眠的 几点建议
- 解决两个jar包中META-INF文件内容重复的bug
- Ubuntu安装snort
- iOS远程推送原理及实现过程
- vickate_CocoaPods安装和使用
- 一个很实用的js验证框架实现源码
- c++第三次实验一类和对象2
- 图像分割技术(3)
- 单片机同时连接另一个单片机与串口的电路设计