记录一下这个报错
报错内容
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里坐标引用爆红可以试试以管理员身份运行