9
votes

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?

4
Proxy is one reason should be fixed first. Best is to call your build from command line via mvn -U clean package. If this won't help just go to your local repository into folder .m2/repository/org/apache/maven/plugins/ and remove everything and retry you build.khmarbaise
removed everything from repo and after calling build from command line getting this error : Downloading: repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- clean-plugin/2.5/maven-clean-plugin-2.5.pom [INFO] ------------------------------------------------------------------------user2501168
[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.374s [INFO] Finished at: Tue Oct 29 13:05:56 IST 2013 [INFO] Final Memory: 2M/15M [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dep endencies could not be resolved: Failed to read artifact descriptor for org.apac he.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apa che.maven.plugins:maven-clean-plugin:pom:2.5 from/to centraluser2501168
(repo.maven. apache.org/maven2): Connection to repo.maven.apache.org refused: Connecti on refused: connect -> [Help 1]user2501168
You have to fixed your connection problems. That's the root cause of your problems.khmarbaise

4 Answers

13
votes

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>
0
votes

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>
0
votes
<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>    
-1
votes

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