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.
- Network issue
- .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:
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.
- Right click on project.
- Go to Maven
- Update project , the check the above option “Force update of Snapshot/Releases“.
- Click on Ok.
- If not fixed restart your eclipse.
Maven access through Proxy
Update your proxy configuration in maven settings.xml file and put it inside .m2 folder
myproxy true http user name password 127.56.8.64 80 local.net|some.host.com
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
Above solutions are my research to resolve this issue if you find out or know other ways please suggest in comments.