I imported my already working project on another computer and it started to download dependencies.
Apparently my internet connection crashed and now I get the foll
Previous versions of maven did not force the check for missing releases when used -U with mvn clean install, only the snapshots, though newer version supports this.
For someone still struggling with previous version, following can be helpful-
On Windows:
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
On Linux:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
Whenever maven can't download dependencies for any reason (connectivity/not exists etc), it will add the ".error=Could not transfer artifact" in dependency-name.lastUpdate file in respective folder under $home/.m2 directory. Removing these files will force maven to try fetching the dependencies again.
If your local repository is somehow mucked up for release jars as opposed to snapshots (-U
and --update-snapshots
only update snapshots), you can purge the local repo using the following:
mvn dependency:purge-local-repository
You probably then want to clean and install again:
mvn dependency:purge-local-repository clean install
Lots more info available at https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html
You can do effectively from Eclipse IDE
. Of course if you are using it.
Project_Name->Maven->Update Project Configuration->Force Update of Snapshots/Releases
I used the IntelliJ IDE and I had a similar problem and to solve I clicked in "Generate Sources and Update Folders for All Projects" in Maven tab.
I've got the error in an other context. So my solution might be useful to others who stumple upon the question:
The problem: I've copied the local repository to another computer, which has no connection to a special repository. So maven tried to check the artifacts against the invalid repository.
My solution: Remove the _maven.repositories files.
We can force to get latest update of release and snapshot repository with below command :
mvn --update-snapshots clean install