Connect to repo.maven.apache.org:443 plugin failed: Connection time

博客分享了解决Maven命令行操作时因连接中央仓库超时导致的构建失败问题。通过在pom.xml中添加配置,将仓库镜像替换为阿里云仓库,确保项目依赖和插件可以从国内镜像快速下载,从而避免了访问国外服务器的网络延迟。

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

分享一个卡了一天的问题

问题描述:

通过idea左侧maven工具栏里面的clean,package,install操作成功。但是当我通过Terminal栏命令的形式mvn clean、mvn package、mvn install相关命令会出现

Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-cl
ean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://r
epo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.52.215] faile
d: Connection timed out: connect -> [Help 1]

此错误可以理解为,我们编写打包需要的maven plugin去
中央仓库https://repo.maven.apache.org/maven2下载,国外服务器所以会超时

解决方式

<repositories>
		<repository>
			<id>mirror</id>
			<url>http://10.160.158.175:8081/repository/omcsvn/</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>mirror-plugin</id>
			<url>https://maven.aliyun.com/repository/public</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>
此处repositories中配置的是项目本地的远程代码仓库
	项目本身的依赖会从此仓库中拉取
pluginRepositories配置的是编译所需要的plugin依赖仓库
	编译需要的plugin从aliyun镜像拉取
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值