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
What maven does is, it downloads all your project's dependencies into your local repo (.m2 folder). Because of the internet causing issues with your local repo, you project is facing problems. I am not sure if this will surely help you or not but you can try deleting all the files within the repository folder inside the .m2 folder. Since there would be nothing in the local repo, maven would be forced to download the dependencies again, thus forcing an update. Generally, the .m2 folder is located at c:users:[username]:.m2
-U is used to force update maven Repo. Use
mvn -U clean install
I had this problem for a different reason. I went to the maven repository https://mvnrepository.com looking for the latest version of spring core, which at the time was 5.0.0.M3/ The repository showed me this entry for my pom.xml:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.0.M3</version>
</dependency>
Naive fool that I am, I assumed that the comment was telling me that the jar is located in the default repository.
However, after a lot of head-banging, I saw a note just below the xml saying "Note: this artifact it located at Alfresco Public repository (https://artifacts.alfresco.com/nexus/content/repositories/public/)"
So the comment in the XML is completely misleading. The jar is located in another archive, which was why Maven couldn't find it!
-U
seems to force update of all dependencies.
If you want to update a single dependency without clean or -U
you could just remove it from your local repo and then build.
The example below if for updating slf4j-api 1.7.1-SNAPSHOT
:
rm -rf ~/.m2/repository/org/slf4j/slf4j-api/1.7.1-SNAPSHOT
mvn compile
It's important to add that the main difference of running mvn
with -U and without -U is that -U
will override your local SNAPSHOT jars with remote SNAPSHOT jars.
Local SNAPSHOT jars created from local mvn install
in cases where you have other modules of your proj that generate jars.
This is one of the most annoying things about Maven. For me the following happens: If I add a dependency requesting more dependencies and more and more but have a slow connection, it seams to stop while downloading and timing out. While timing out all dependencies not yet fetched are marked with place holders in the .m2 cache and Maven will not (never) pick it up unless I remove the place holder entry from the cache (as other stated) by removing it.
So as far as I see it, Maven or more precise the Eclipse Maven plugin has a bug regarding this. Someone should report this.