1.第三方jar发布
web
例子:服务器
打开命令行进入到maven安装目录下的bin目录,敲入以下指令,具体参考根据状况修改,下面有参数详细说明。
app
mvn deploy: deploy-file -DgroupId=hw.vedioicon -DartifactId=vedioicon -Dversion=1.0 -Dpackaging=jar -Dfile=D:\workspace\web-mooc\src\main\webapp\WEB-INF\lib\vedioicon.jar -Durl=http://192.168.117.254:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty
DgroupId和DartifactId构成了该jar包在pom.xml的坐标,项目就是依靠这两个属性定位。本身起名字也行。webapp
Dfile表示须要上传的jar包的绝对路径。maven
Durl私服上仓库的位置,打开nexus——>repositories菜单,能够看到该路径。ui
DrepositoryId服务器的表示id,在nexus的configuration能够看到。url
上传成功后,在nexus界面点击3rd party仓库能够看到这包。spa
2.项目发布:
.net
pom配置:
命令行
<distributionManagement> <repository> <id>releases</id> <url>http://192.168.117.254:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <name>nexus distribution snapshot repository</name> <url>http://192.168.117.254:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
项目右键 run-maven-build 在goal中填写deploy直接运行便可
权限配置:在用户或maven的配置settings.xml,注意若是用户下.m2中配置了settings,以.m2中的为主
<servers> <server> <id>releases</id> <username>deployment</username> <password>******</password> </server> <server> <id>snapshots</id> <username>deployment</username> <password>******</password> </server> <server> <id>thirdparty</id> <username>deployment</username> <password>******</password> </server> </servers>
注意id必定要和server中的id统一
部份内容参考:http://blog.csdn.net/hongqishi/article/details/9187775