mojohaus/versions

update-properties takes a lot of time for some projects

Opened this issue · 4 comments

I wonder if it's intentional when calling update-properties to check the metadata of all defined dependencies if we pass includesList which will end up skipping version updates for most of them?

I invoke something like this:
mvn org.codehaus.mojo:versions-maven-plugin:2.16.2:update-properties -DallowMinorUpdates=false -Dincludes=my.groupId.*,my.other.groupId.*

And for some projects it takes even about 30 minutes to finally update only a few of my own dependencies among the multitude of third-party dependencies that I do not want to update automatically.

Which Maven version do you use?

A debug log (mvn ... -X) can help to investigate which task take the most time

I'm using Maven version 3.8.8, but I also tested it on version 3.9.1.

The most time-consuming task is to download maven-metadata.xml files. I download them, like all defined dependencies, through my own Nexus server.
Downloading the dependencies itself does not take that much time, but maybe the slow download of maven-metadata.xml files is due to the fact that it is a less frequent operation and the next time the versions plugin is invoked, these files are no longer stored in the Nexus cache.

However, when calling update-properties it seems that maven-metadata.xml files are downloaded for all defined dependencies, not just those defined by includesList.

In method: org.codehaus.mojo.versions.api.DefaultVersionsHelper#getVersionPropertiesMap we only skip properties by property name.

we have a code:

            Dependency[] dependencies = property.getDependencies();
            if (dependencies != null) {
                for (Dependency dependency : dependencies) {
                    getLog().debug("Property ${" + property.getName() + "}: Adding association to " + dependency);
                    builder.withAssociation(this.createDependencyArtifact(dependency), false);
                }
            }

where dependencies are not filtered, and next method org.codehaus.mojo.versions.api.PropertyVersionsBuilder#build cause to resolve version for all artifacts.

Finally in method org.codehaus.mojo.versions.UpdatePropertiesMojoBase#update artifact are filtered and update only what is needed.