Spring Boot batch App - Maven error

限于喜欢 提交于 2019-12-12 02:17:40

问题


I have created a Spring boot batch maven project using Spring Initializr. When i imported the downloaded zip as maven project on my STS, i faced the following problem,

Failure to transfer org.springframework.batch:spring-batch-infrastructure:jar:3.0.7.RELEASE from https://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.springframework.batch:spring-batch-infrastructure:jar:3.0.7.RELEASE from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.

Spring boot version - 1.5.2

Java - 1.8

After several hours of changes and attempts, the issue was reolved once i decided to delete the contents under my local maven repo 'C:\Local.m2\repository'. Basically i,

  1. Closed my STS
  2. Deleted all the contents of my local maven repo
  3. Open the STS
  4. Update the project (Maven -> Update Project)

Now my question is, can someone explain what has happened here? Is there a way to prevent these kind of issues. This had taken away lot of my time. Is there any way to create project using Spring Initializr without these issues?


回答1:


It's basically a problem with the download, you can't know for sure when it's going to happening.

Using the "delete approach", you don't need to remove ALL your maven repo, just the one that's facing the issue.

But the error message tell's that:

resolution will not be reattempted until the update interval of central has elapsed or updates are forced.

You don't want to wait, of course, so your can force the update running mvn clean install -U from command line, or using STS on Run as -> Maven build... and write clean install -U at goals field. -U means: force update!



来源:https://stackoverflow.com/questions/42657335/spring-boot-batch-app-maven-error

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