maven编译报错“系统找不到指定的路径“

记录一下这个报错

报错内容

3.8晚上:

第一次用mvn compile的时候报错了,系统找不到指定的路径,我试了网上好多方法都不行,最后我把黑马给的资料里的Maven本地仓库复制到mvn_resp文件里,再运行就成功了,也不知道为什么,记一下

compile / clean执行成功,但是test / package / install一直报错,还是系统找不到指定的路径

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project maven-project: Unable to generate classpath: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information for org.apache.maven.surefire:surefire-junit4:jar:2.12.4: Failed to retrieve POM for org.apache.maven.surefire:surefire-junit4:jar:2.12.4: Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.12.4 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): D:\software\apache-maven-3.6.1\mvn_resp\org\apache\maven\surefire\surefire-junit4\2.12.4\surefire-junit4-2.12.4.pom.part.lock (系统找不到指定的路径。)
[ERROR]   org.apache.maven.surefire:surefire-junit4:jar:2.12.4
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR]   alimaven (http://maven.aliyun.com/nexus/content/groups/public/, releases=true, snapshots=false)
[ERROR] Path to dependency:
[ERROR]         1) dummy:dummy:jar:1.0
[ERROR]
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

网上找到的:在目录中名称中,不能出现&符号,换成别的符号就可以。我试了还是不行,我操


解决

3.9下午:

又找了几个方法类似这种的,把这个加到pom里,但还是没用

<build>
	  <plugins>
		<plugin>
		  <groupId>org.apache.maven.plugins</groupId>
		  <artifactId>maven-surefire-plugin</artifactId>
		  <version>2.12.4</version>
		</plugin>
	  </plugins>
	</build>

在这里插入图片描述
最后
博客园看到一个
maven编译maven-surefire-plugin插件报错
在这里插入图片描述

但是加在pom.xml文件时报错,plugin位置放错了,去网上搜

plugin在pom文件中的位置:需要在build下面加上plugins然后放在里面

<!--博客园看到的-->
<build>
  <plugins>
	<plugin>
	  <artifactId>maven-surefire-plugin</artifactId>
	  <version>2.12.4</version>
	 <configuration>
		<skipTests>true</skipTests>
	</configuration>
	</plugin>
  </plugins>
</build>

最后终于解决,泪目了,感谢这位博客园的大佬
在这里插入图片描述

新报错

接3.10,我发现坐标引用依赖爆红,然后install不了,网上找了一些方法,就是需要修改D:\apache-maven-3.6.3\conf下settings.xml文件。在标签中注意用https -> s,http是好久之前的,我改完这个之后还没好,就找到了一个新的阿里云配置,也是没用,然后有一篇文章说用管理员命令行运行,我试了,最后终于可以下载下来了

阿里云配置指南

打开 maven 的配置文件( windows 机器一般在 maven 安装目录的 conf/settings.xml ),在标签中添加 mirror 子节点:

<mirror>
  <id>aliyunmaven</id>
  <mirrorOf>*</mirrorOf>
  <name>阿里云公共仓库</name>
  <url>https://maven.aliyun.com/repository/public</url>
</mirror>

如果在IDEA里坐标引用爆红可以试试以管理员身份运行

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值