当前位置:

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

访客 2024-01-29 1168 0

记录一下这个报错

报错内容

3.8晚上:

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

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

[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-surefire-plugin:2.12.4:test(default-test)onprojectmaven-project:Unabletogenerateclasspath:org.apache.maven.artifact.resolver.ArtifactResolutionException:Unabletogetdependencyinformationfororg.apache.maven.surefire:surefire-junit4:jar:2.12.4:FailedtoretrievePOMfororg.apache.maven.surefire:surefire-junit4:jar:2.12.4:Couldnottransferartifactorg.apache.maven.surefire:surefire-junit4:pom:2.12.4from/toalimaven(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]fromthespecifiedremoterepositories:[ERROR]alimaven(http://maven.aliyun.com/nexus/content/groups/public/,releases=true,snapshots=false)[ERROR]Pathtodependency:[ERROR]1)dummy:dummy:jar:1.0[ERROR][ERROR][ERROR]->[Help1][ERROR][ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswitch.[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging.[ERROR][ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleasereadthefollowingarticles:[ERROR][Help1]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里坐标引用爆红可以试试以管理员身份运行

发表评论

  • 评论列表
还没有人评论,快来抢沙发吧~