解决maven执行mvn help:system出错的问题

通过dos检测道maven安装成功后,在maven的conf目录下修改settings.xml文件中的国内镜像时,执行mvn help:system命令时出错,原因在于url地址出错,如下我网上找到的阿里云镜像:

<mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>

原因在于url地址中最后的/,将其删除保存即可,如下

<url>http://maven.aliyun.com/nexus/content/groups/public</url>

然后重启dos,再次执行mvn help:system,
等待片刻,看到下图中显示的BUILD SUCCESS字样,即代表更换国内镜像成功
在这里插入图片描述

还有个问题需注意下,上面成功后,在idea里maven还遇到错误:
Maven:sun.security.validator.ValidatorException: PKIX path building failed
这个是 HTTPS 的证书安全检查问题,最简单的方式是忽略SSL的证书检查,在 maven 打包命令中加上参数-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true,如下图
图片位置
我记得还有个问题是IDEA和Maven的版本兼容问题,忘记了,你们注意一下
这里放上我的setting.xml文件,以供参考

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
    <localRepository>E:\Maven\maven-repository</localRepository>

  <pluginGroups>
  </pluginGroups>

  <proxies>
  </proxies>

  <servers>
  </servers>

  <mirrors>
	 <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
	
	 <mirror>
      <id>nexus-aliyun</id>
      <mirrorOf>*</mirrorOf>
      <name>Nexus aliyun</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
 
  <profiles>
	<profile>
		<id>jdk-1.8</id>
		<activation>
			<activeByDefault>true</activeByDefault>
			<jdk>1.8</jdk>
		</activation>
		<properties>
			<maven.compiler.source>1.8</maven.compiler.source>
			<maven.compiler.target>1.8</maven.compiler.target>
			<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
		</properties>
	</profile>
  </profiles>
</settings>

还有关键信息截图也放上来
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值