If a project dependency gets overwritten in project.xml and due the specified path to the overwrite jar is wrong, maven downloads the jar file specified in project.xml and saves it under the file name specified in project.properties. For example (that's how I found the bug):
In project.xml I specified:
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>2.0-final</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
Since I had some complication issues with 2.0-final I wanted to compile agaist a version I had on my hard disk from a previous project called hibernate.jar. I copied the jar into the lib directory of the project and modified project.properties to include:
maven.jar.override = on
maven.jar.hibernate = ${basedir}/lib/hiberante.jar <- note the typo
When I tried to compile maven downloaded hibernate-2.0-final.jar and saved it under lib/hiberante.jar without error message. I would expect if a jar gets overwritten with a path to another jar and this jar does not exist an UnsatisfiedDependencyException should be thrown.
I believe the problem is that in this described case the artifact for hibernate gets added to the failedDependencies list in DependencyVerifier.satisfyDependencies(), because artifact.exist() will return false. This there is now an entry in the list getDependencies() is getting called and hibernate-2.0-final.jar will be downloaded and saved under the path specified in project.properties. I guess getDependencies() should check the artifact type prior to downloading.
I made the fix in my version of maven and it seems to work. I am happy to send the fix to whoever is fixing the bug.
http://wiki.codehaus.org/maven/SubmittingPatches
Thanks!