Maven 打包项目到私服 (deploy)的配置方法
一、配置maven
在maven安装目录 /conf/setting.xml 中的servers下添加:
<servers> <server> <id>nexus-snapshots</id> <username>admin</username> <password>123456</password> </server> <server> <id>nexus-releases</id> <username>admin</username> <password>123456</password> </server> </servers>
二、配置pom
在maven工程的pom.xml配置部署的仓库,注意pom.xml和setting.xml中的id属性要一致
<!-- 发布maven私服 --> <distributionManagement> <repository> <id>nexus-snapshots</id> <name>tuohang-framework-SNAPSHOTS</name> <url>http://47.100.xxx.xxx:30010/repository/3rd-part/</url> </repository> <snapshotRepository> <id>nexus-repository</id> <name>tuohang-framework-REPOSITORY</name> <url>http://47.100.xxx.xxx:30010/repository/3rd-part/</url> </snapshotRepository> </distributionManagement>
三、使用deploy命令上传
在项目路径下使用命令:
mvn deploy -Dmaven.test.skip=true
或者:mvn deploy:deploy-file -Dmaven.test.skip=true -Dfile=D:\workspace\com.xxx.test-1.0.0.jar -DgroupId=com.xxx -DartifactId=test -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -DrepositoryId=nexus-repository-Durl=http://192.168.xxx.xxx:9090/repository/3rd-part/
如图build success 代表成功。
四、使用
<!-- 远程nexus仓库 --> <repositories> <repository> <id>nexus-snapshots</id> <url>http://47.100.xxx.xxx:30010/repository/3rd-part/</url> </repository> <repository> <id>nexus-repository</id> <url>http://47.100.xxx.xxx:30010/repository/3rd-part/</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus-snapshots</id> <url>http://47.100.xxx.xxx:30010/repository/3rd-part/</url> </pluginRepository> <pluginRepository> <id>nexus-repository</id> <url>http://47.100.xxx.xxx:30010/repository/3rd-part/</url> </pluginRepository> </pluginRepositories>
到此这篇关于Maven 打包项目到私服 (deploy)的文章就介绍到这了,更多相关Maven 打包项目到私服内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
springboot1.X和2.X中如何解决Bean名字相同时覆盖
这篇文章主要介绍了springboot1.X和2.X中如何解决Bean名字相同时覆盖,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教2022-03-03SpringMVC中的@RequestMapping注解的使用详细教程
@RequestMapping注解的作用就是将请求和处理请求的控制器方法关联起来,建立映射关系,本文主要来和大家详细讲讲它的具体使用,感兴趣的可以了解一下2023-07-07Java持久化框架Hibernate与Mybatis优劣及选择详解
这篇文章主要介绍了Java持久化框架Hibernate与Mybatis优劣及选择详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪2023-05-05
最新评论