Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependencies in local REPO have .lastUpdated extension

Tags:

maven

When I try to to install maven project in local repository, I notice that pom and jar files have .lastUpdated extension. Because of this issue I cannot build my project which depends on it.

Could you please explain why it happens?

like image 484
Sergii Shevchyk Avatar asked May 27 '13 06:05

Sergii Shevchyk


People also ask

What is Maven Lastupdated file?

These files indicate to Maven that it attempted to obtain the archive by download, but was unsuccessful. In order to save bandwidth it will not attempt this again until a certain time period encoded in the file has elapsed. The command line switch -U force maven to perform the update before the retry period.

Where all Maven dependencies are stored?

When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository. It helps to avoid references to dependencies stored on remote machine every time a project is build. Maven local repository by default get created by Maven in %USER_HOME% directory.


1 Answers

I've found the answer here :

When an artifact is unable to be downloaded, Maven 3 caches this result for future reference in the "~/.m2/repo/.../.lastUpdated" file. For "not found" situations, it seems that the HTTP code could be used to more granularly re-attempt retrieval rather than just cache the failure. For example, for any 404, I agree, the result should cache the failure and require a -U to attempt to retrieve it again. However, for 400, 500, 501, 502, 503, 301, 302 (what's the Maven behavior for 3xx today?) I think the resolution engine should try to re-retrieve the artifact each time. With those error codes, it seems more likely a config issue or brief network hiccup, not one of the file being absent from that repo. However, that brief network hiccup has longstanding cache implications in that the file is never attempted to be retrieved again.

like image 194
Sergii Shevchyk Avatar answered Sep 22 '22 22:09

Sergii Shevchyk