Description

Create a project (let's call this projectA) with a class named ClassA having a method named methodA(). Set the version as 1.0-SNAPSHOT and set uniqueVersion=true.

Deploy this in a remote repository

Create another project (let's call this projectB) which has a dependency on projectA. Set the dependency's version to the specific timestamped version when projectA was deployed in step 2. Create a class named ClassB and add a method which invokes ClassA's methodA().

Add your remote repository either in the settings or in the pom.

Build projectB. You will get a successful build.

Now go back to projectA and remove methodA() from classA.

Deploy projectA to the remote repository again.

Update the dependency version of projectA in projectB's pom.xml. Set it to the latest timestamp version.

Build projectB. Your build will fail because methodA() was removed.

Revert the dependency version of projectA in projectB's pom.xml. Set it to the same value you've set in step 3.

Build projectB. Your build will still fail even though you've set the correct version.

Maria Odea Ching
added a comment - 09/Jun/09 5:56 AM - edited Attaching MNG-4189 -maven-2.1.x.patch to fix this issue. Unit tests included in the patch. Could someone please review this before I commit it to 2.1.x branch? Thanks in advance!

In other words, the flag resolved will always be true. This in turn will make if ( resolved || !copy.exists() ) equivalent to if (true), thereby always executing the FileUtils.copyFile(destination, copy). Hence, Maven will end up copying each and every snapshot dependency. For bigger projects, I can imagine this accumulates to significant IO, slowing down the build.

The attached patch proposes to compare the file's timestamp&size instead of using the resolved flag. This should also ensure that artifact-<baseVersion>.jar matches the last resolved timestamp version but still avoids unnecessary file copies in case nothing changed.

Benjamin Bentmann
added a comment - 11/Jun/09 7:08 AM With your patch, we effectively have
boolean resolved = false ;
if ( !destination.exists() || force )
{
...
resolved = true ;
}
else if ( destination.exists() ) // Note that this is equivalent to just " else "
{
...
resolved = true ;
}
In other words, the flag resolved will always be true . This in turn will make if ( resolved || !copy.exists() ) equivalent to if (true) , thereby always executing the FileUtils.copyFile(destination, copy) . Hence, Maven will end up copying each and every snapshot dependency. For bigger projects, I can imagine this accumulates to significant IO, slowing down the build.
The attached patch proposes to compare the file's timestamp&size instead of using the resolved flag. This should also ensure that artifact-<baseVersion>.jar matches the last resolved timestamp version but still avoids unnecessary file copies in case nothing changed.

A comment about the IT: I suggest to remove the checksum files (*.md5, *.sha1) from the test repository and just setup the repo to ignore the checksums. Files that are not vital for a test otherwise simply cause IO and slow down resource copying/extraction during testing. This is not relevant for a single test but we approach 400 ITs so there's a certain scaling factor to consider.

Benjamin Bentmann
added a comment - 11/Jun/09 7:19 AM A comment about the IT: I suggest to remove the checksum files (*.md5, *.sha1) from the test repository and just setup the repo to ignore the checksums. Files that are not vital for a test otherwise simply cause IO and slow down resource copying/extraction during testing. This is not relevant for a single test but we approach 400 ITs so there's a certain scaling factor to consider.