Issue Details (XML | Word | Printable)

Key: MAVEN-1518
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Brett Porter
Reporter: Hardy Ferentschik
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 1

Wrong behaviour for non existing overwritten dependency

Created: 26/Nov/04 11:12 AM   Updated: 08/Mar/06 10:44 PM
Component/s: core
Affects Version/s: 1.0.1
Fix Version/s: 1.0.2

Time Tracking:
Not Specified

File Attachments: 1. Text File DependencyVerifier.java.patch (1 kB)



 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Brett Porter added a comment - 26/Nov/04 06:22 PM
please attach it to this entry using the instructions here:
http://wiki.codehaus.org/maven/SubmittingPatches

Thanks!


Hardy Ferentschik added a comment - 27/Nov/04 02:17 PM
To fix the described bug I just added an additional check for Artifact.OVERRIDE_PATH in getDependencies() of DependencyVerifier.

Brett Porter added a comment - 04/Dec/04 01:17 AM
applied, thanks