[Solved] Could not transfer artifact org.springframework:XYZ from/to central (https://repo.maven.apache.org/maven2)


Generally this error message shows in pom.xml when create new project with dependencies or add new dependencies in pom.xml.

Reason to cause this error

There are several reason to cause this error as below because maven is unable to connect to Maven repository at http://repo1.maven.org/maven2.

  1. Proxy
  2. Network issue
  3. .lastUpdate file for dependency

Could not transfer artifact org.springframework:spring-expression:jar:5.1.6.RELEASE from/to central (https://repo.maven.apache.org/maven2): C:\Users\saurabh.gupta1\.m2\repository\org
 \springframework\spring-expression\5.1.6.RELEASE\aether-fa07bf3e-4fa1-4911-bcad-3319e4b2480e-spring-expression-5.1.6.RELEASE.jar-in-progress (The system cannot find the file 
 specified) org.eclipse.aether.transfer.ArtifactTransferException:
 

Solutions

There are few ways i find out to resolve this issue:

Maven Force Update of Snapshot/Releases

Follow below steps to to resolve this issue and clear all dependencies error in eclipse.

  1. Right click on project.
  2. Go to Maven
  3. Update project , the check the above option “Force update of Snapshot/Releases“.
  4. Click on Ok.
  5. If not fixed restart your eclipse.

Maven Force Update 1

Maven Force Update 2

Maven access through Proxy

Update your proxy configuration in maven settings.xml file and put it inside .m2 folder

C:\Users\USER NAME.m2

proxy settings


<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0                               
http://maven.apache.org/xsd/settings-1.0.0.xsd">

 <proxies>
    <proxy>
      <id>myproxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>user name</username>  <!-- Put your user name here -->
      <password>password</password>   <!-- Put your password here -->
      <host>127.56.8.64</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 touch this setting unless you know what you're doing. -->
    </proxy>  
  </proxies>
</settings>

You don’t need to touch , and sections, unless you really know what are these tags.

After updating this setting restart eclipse and follow the steps in Maven Force update of Snapshot/Releases.

Remove .lastUpdated file

If this problem is not resolved yet got to .m2/repository/ to dependency sub directory and remove .lastUpdate file inside of it or delete complete directory for this particular dependency and again follow the steps in Maven Force update of Snapshot/Releases.

For Example as for above issue directory location showing in exception as

C:\Users\saurabh.gupta1.m2\repository\org
\springframework\spring-expression\5.1.6.RELEASE

Above solutions are my research to resolve this issue if you find out or know other ways please suggest in comments.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s