Maven Deploy

本文介绍如何通过配置POM文件和settings.xml文件将项目部署到Nexus仓库。首先需要在POM文件中添加distributionManagement属性指定发布路径,然后在settings.xml文件中设置身份验证信息。最后使用mvn deploy命令完成部署。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先在项目的POM文件中,添置distributionManagement属性;

用于指明项目提交到地方!

 

Pom.xml设置:

http://host:8080/nexus 是可以連到nexus server的url <id>nexus</id> 是辨識用的repository id,必須跟下面的settings.xml一致。

<distributionManagement>
	<!-- use the following if you're not using a snapshot version. -->
	<repository>
		<id>nexus</id>
		<name>Internal Releases</name>
		<url>http://host:8080/nexus/content/repositories/releases</url>
	</repository>
	<!-- use the following if you ARE using a snapshot version. -->
	<snapshotRepository>
		<id>nexus</id>
		<name>Internal Releases</name>
		<url>http://host:8080/nexus/content/repositories/snapshots</url>
	</snapshotRepository>
</distributionManagement>

 

.settings.xml文件设置:

<id>nexus</id> 是辨識用的repository id,必須跟上面的pom.xml中的一致

<servers>
	<server>
		<id>nexus</id>
		<username>username</username>
		<password>password</password>
	</server>
	<server>
		<id>thirdparty</id>
		<username>username</username>
		<password>password</password>
	</server>
</servers>
 

 

最后一步,执行deploy命令,实现发布:

mvn deploy
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值