上传jar到nexus

有些第三方的jar,没有maven仓库,比如阿里和银联的sdk就不存在任何maven仓库中,我们可以从其官网下载下来,传到自己的私服中,然后引入私服中的该jar.
1, 上传到私服,执行如下maven命令
mvn deploy:deploy-file -DgroupId=自定义(如com.baidu) -DartifactId=自定义(如abc) -Dversion=自定义(如1.8) -Dpackaging=jar -Dfile=E:\xxx.jar -Durl=http://192.168.2.214:8081/repository/maven-3rd/ -DrepositoryId=maven-3rd

上面就是把E:\xxx.jar 上传到了私服的maven-3rd 这个仓库中, 并且指定了该xxx.jar的groupId=com.baidu, artifactId=abc, version=1.8

2, pom.xml引用
<dependency>
	<groupId>com.baidu</groupId>
	<artifactId>abc</artifactId>
	<version>1.8</version>
</dependency>

猜你喜欢

转载自18810098265.iteye.com/blog/2369689