Maven Pom.xml issue

♀尐吖头ヾ 提交于 2019-12-05 22:51:32

问题


I'm trying to make a spring mvc project using maven and getting following error in pom.xml:

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 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.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http:// repo.maven.apache.org/maven2): Connection refused: no further information to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom

Is it related to proxy or firewall? What can I do to fix it?


回答1:


Sounds like you need to set up a maven proxy in your settings.xml.

Have a look (for example) in your web browser and see how it is set up.

From the documentation on Configuring a proxy:

<proxy>
  <active>true</active>
  <protocol>http</protocol>
  <host>proxy.somewhere.com</host>
  <port>8080</port>
  <username>proxyuser</username>
  <password>somepassword</password>
  <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
</proxy>



回答2:


I fixed a similar problem (i.e. Could not transfer artifact... connection refused...) in my case by fixing the repositories. Actually, I added the release repo where only the milestone one was present and refused connections. Sugg.: check which repo are needed and/or copy them from a POM without the issue.

<repositories>
    <repository>
        <id>repo.springsource.org.milestone</id>
        <name>Spring Framework Maven Milestone Repository</name>
        <url>https://repo.springsource.org/milestone</url>
    </repository>
    <repository> <!-- this one added -->
        <id>repository.springframework.maven.release</id>
        <name>Spring Framework Maven Release Repository</name>
        <url>http://maven.springframework.org/release</url>
    </repository>
</repositories>



回答3:


<proxy>
  <id>myproxy</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>chenchu.madhiboina</username>  <!-- LOG in username/Put your username here -->
  <password>hari01</password>  <!-- LOG in password/Put your password here -->
  <host>xx.xx.xx.xx</host>   <!-- Put the IP address of your proxy server here -->
  <port>80</port>            <!-- Put your proxy server's port number here -->
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts> <!-- Do not use this setting unless you know what you're doing. -->
</proxy>    



回答4:


This error is because you are behind the proxy and maven couldnot download few jars required. In office network I was getting the same error. Then I tried in home wifi and the error was no more. I didnt change setting.xml just followed below steps 1. Connect to network which doesnot have any proxy or firewall 2. Right click on the project-->maven-->Update project



来源:https://stackoverflow.com/questions/19652101/maven-pom-xml-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!