Here is the result of mvn -version:
Apache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
Maven home: /usr/share/maven
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
Suppose I have a snapshot dependency:
<dependency>
<groupId>org.puzzled</groupId>
<artifactId>foo</artifactId>
<version>1.0.4-SNAPSHOT</version>
</dependency>
I have a downloaded copy of that snapshot in my local repo. But then other developers have made improvements and there is an update to the foo-1.0.4-SNAPSHOT.jar. I want to issue Maven an executive order to update that dependency by downloading it from a remote repository.
According to the response to this and many other questions on SO, if I do
mvn clean -U package
it should just (re)download all the dependencies. Right? That is not what happens. It downloads metadata for snapshot dependencies, deduces (and wrongly, at that) that no updating is required. I have to delete the associated subdirectory in my local .m2 repository for Maven to update a snapshot release from the remote repo, even with the -U flag.
Is this a bug, or am I missing something?