-1

When starting the application following resolving issue is raised.

Cannot resolve org.springframework.boot:spring-boot-devtools:pom:2.6.5 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt.
This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer artifact org.springframework.boot:spring-boot-devtools:pom:2.6.5 from/to central (https://repo.maven.apache.org/maven2):
    transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-devtools/2.6.5/spring-boot-devtools-2.6.5.pom

The URL is reachable.

Valerij Dobler
  • 1,848
  • 15
  • 25
Sahan
  • 213
  • 1
  • 2
  • 8
  • Can you reach that url in your browser? Does it output a valid pom? – f1sh Mar 30 '22 at 09:38
  • yes, url is reachable – Sahan Mar 30 '22 at 09:42
  • 2
    go to your local maven repo (in your user home) at `.m2/org/springframework/boot/spring-boot-devtools` and delete all the files in there, that resets maven's caching. Then try to build your project again. – f1sh Mar 30 '22 at 09:45
  • It worked, thnx – Sahan Mar 30 '22 at 09:55
  • You should turn on checkPolicy see more details: https://blog.soebes.de/blog/2018/10/13/maven-artifact-checksums-what/ – khmarbaise Mar 30 '22 at 09:59
  • 1
    @f1sh You can delete the artifact or use `-U` switch in `mvn` command to force update the cached artifacts. – seenukarthi Mar 30 '22 at 10:00
  • 1
    @KarthikeyanVaithilingam I am aware of -U, however more often than not it doesn't work for me, no idea why. Deleting the files however always solves this issue. – f1sh Mar 30 '22 at 10:03
  • @f1sh I'm not sure why it didn't work for you, may be some wired permission issue? (speculating). – seenukarthi Mar 30 '22 at 10:09

2 Answers2

2

It seems that your local version (inside ~/.m2/repository) of this dependency is corrupted. Try deleting it there and restart the download process from maven central again.

Valerij Dobler
  • 1,848
  • 15
  • 25
0

When you build the application after adding a dependency when maven try to download the artifact and its dependencies the download may fail for some reason (may be a network issue) then maven put a file with the timestamp of the first try. if you try maven build after that first try maven reorganize the first try failed and check the timestamp to check weather sufficient time has elapsed if not it will throw This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced

If you want to force maven to update the dependencies those are failed before update interval you can use -U switch.

So run you maven goal with -U switch like mvn <goal> -U

seenukarthi
  • 8,241
  • 10
  • 47
  • 68