安装第三方jar包到本地仓库
1.进入需要安装的 jar包所在目录cmd 运行 这里以 fastjson-1.1.37.jar 为列子 -Dpackaging=jar对应 jar
-DgroupId=com.alibaba -DartifactId=fastjson 为 公司名 和 包名
mvn install:install-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37 -Dfile=fastjson-1.1.37.jar -Dpackaging=jar
2.不需要进入jar所在目录 打开cmd直接运行 xxxx为 jar包所在绝对路径
mvn install:install-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37 -Dpackaging=jar -Dfile=xxxx/fastjson-1.1.37.jar
安装第三方jar包到私服
在settings配置文件中添加登录私服第三方登录信息
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
进入jar包所在目录运行
mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37 -Dpackaging=jar -Dfile=fastjson-1.1.37.jar -Durl=http://localhost:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty
durl为 公司 私服的url路径 thirdparty代表上传到第三方jar包 DrepositoryId 与setting中配置对应
也可以不用 进入jar包所在目录运行 原理与本地一样