eclipse创建maven web项目时,pom.xml文件报错

    xiaoxiao2021-03-25  55

    最近学习maven时,真是错误重重啊。进入正题。

    1.当使用eclipse创建maven web项目时,发现pom.xml文件报错。

    错误:

    Failure to transfer org.codehaus.plexus:plexus:pom:1.0.12 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus:pom:1.0.12 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.12/plexus-1.0.12.pom

    2.按照网上的解决办法

    第一种方案:

    结果:没起作用

    第二种方案:

    ------------------------------------------------------------------------------------------------------------------------------------------

    结果:还是没解决问题。

    3.分析错误解决

    大概意思是从http://repo.maven.apache.org/maven2 was cached in the local repository网址错误地转换成org.codehaus.plexus:plexus:pom:1.0.12文件。并且将这个文件进行了缓存。在中心仓库更新期间也没有重新尝试执行移除或者更新。

    原本的错误:不能转换pom.xml中的artifact。

    org.codehaus.plexus:plexus:pom:1.0.12 from/to central (http://repo.maven.apache.org/maven2)这个url连接另一个http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.12/plexus-1.0.12.pom的url超时了。

    后面两行都是由于最前面的错误,才执行后面的。所以问题在加粗的地方。

    发现plexus-1.0.12.pom.xml这个文件有问题,那么就给它删除重新生成呗。在本地仓库找到这个文件。

    然后将里面的文件删除,然后使用打开eclipse重新生成:

    解释:更新这个项目。

    -------------------------------------------------------------------------------------------------------------------------------

    执行更新这个依赖。

    4.结果

    maven项目的pom.xml文件不再报错了。

    转载请注明原文地址: https://ju.6miu.com/read-33421.html

    最新回复(0)