如何解决maven中snapshot相关jar无法拉取问题

本文介绍了当maven无法拉取snapshot相关jar时的两种解决方案:1. 在项目pom.xml中配置;2. 在settings.xml中配置,关键在于启用snapshot快照库。

如何解决maven中snapshot相关jar无法拉取问题?
这里提供2中解决方案
1、在项目中的pom.xml里面配置

<repositories>
	<repository>
		<id>nexus</id>
		<url>http://192.168.1.221:8081/nexus/content/groups/public/</url>
		<releases>
			<enabled>true</enabled>
			<updatePolicy>always</updatePolicy>
		</releases>
		<snapshots>
			<enabled>true</enabled>
			<updatePolicy>always</updatePolicy>
		</snapshots>
	</repository>
</repositories>

2、在 settings.xml 里面配置

<profiles>
	<profile>
		<id>roncoo-profile</id>
		<repositories>
			<repository>
				<id>nexus</id>
				<url>http://192.168.1.221:8081/nexus/content/groups/public/</url>
				<releases>
					<enabled>true</enabled>
				</releases>
				<snapshots>
					<enabled>true</enabled>
				</snapshots>
			</repository>
		</repositories>
	</profile>
</profiles>
<activeProfiles>
	<activeProfile>roncoo-profile</activeProfile>
</activeProfiles>

说明:无法拉取是因为maven默认snapshot快照库是不拉取的,以上两种方式都是打开snapshot快照库,允许快照库生效(重要就是snapshot中enabled要设置为true)
第一种是项目级别的,第二种是全局的。
在这里插入图片描述

评论 6
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值