1、准备
(1) 确保本地maven环境已配置
(2) 搭建maven私库,参考博客【使用nexus搭建maven私有仓库】
2、本地打包
以个推jar包为例

(1) 使用cmd打包,执行以下命令:
# mvn deploy:deploy-file -Dmaven.test.skip=true -Dfile=G:\libs\gexin-rp-sdk-http-4.1.1.4.jar -DgroupId=com.gexin.platform -DartifactId=gexin-rp-sdk-http -Dversion=4.1.1.4 -Dpackaging=jar -DrepositoryId=maven-releases -Durl=http://192.168.31.88:8081/repository/maven-releases/
命令注释:
-Dmaven.test.skip=true //跳过编译、测试
-Dfile=D:\lib\gexin-rp-sdk-http-4.1.1.4.jar //jar包文件地址,绝对路径
-DgroupId=com.gexin.platform //gruopId--pom坐标,自定义
-DartifactId=gexin-rp-sdk-http //artifactId--pom坐标,自定义
-Dversion //版本号
-Dpackaging //打包方式
-DrepositoryId //远程库服务器ID
-Durl //远程库服务器地址
(2) 使用管理界面上传jar包

勾选:Generate a POM file with these coordinates,否则可能导致打包失败!
3、maven仓库查看

4、pom文件引用

本文详细介绍了如何在本地环境中配置Maven私有仓库,包括使用Nexus搭建私库的过程,以及通过命令行和管理界面上传jar包到私库的方法。此外,还提供了如何在pom文件中正确引用私库中jar包的步骤。
3664

被折叠的 条评论
为什么被折叠?



