9

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?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
user2501168
  • 91
  • 1
  • 1
  • 2
  • 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 Oct 29 '13 at 07:30
  • removed everything from repo and after calling build from command line getting this error : Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- clean-plugin/2.5/maven-clean-plugin-2.5.pom [INFO] ------------------------------------------------------------------------ – user2501168 Oct 29 '13 at 07:38
  • [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 central – user2501168 Oct 29 '13 at 07:39
  • (http://repo.maven. apache.org/maven2): Connection to http://repo.maven.apache.org refused: Connecti on refused: connect -> [Help 1] – user2501168 Oct 29 '13 at 07:40
  • 1
    You have to fixed your connection problems. That's the root cause of your problems. – khmarbaise Oct 29 '13 at 07:53
  • https://stackoverflow.com/questions/15334394/could-not-transfer-artifact-org-apache-maven-pluginsmaven-surefire-pluginpom2/15335792#15335792 This is solved my problem – Hariprasad Feb 09 '16 at 07:37

4 Answers4

13

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>
vikingsteve
  • 38,481
  • 23
  • 112
  • 156
  • I also had to update my Eclipse preferences to ensure Maven used the settings.xml file ([see this answer](http://stackoverflow.com/a/12076515/1438809)). – Felix Feb 20 '15 at 20:53
0

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>
clstrfsck
  • 14,715
  • 4
  • 44
  • 59
Bernard Hauzeur
  • 2,317
  • 1
  • 18
  • 25
0
<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>    
Hariprasad
  • 19
  • 3
-1

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