Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

versions:resolve-ranges very slow when parents contain lots of version properties #1121

Closed
m-schutte-ohra-nl opened this issue Jul 24, 2024 · 2 comments · Fixed by #1122
Closed
Milestone

Comments

@m-schutte-ohra-nl
Copy link
Contributor

versions:2.17.1:resolve-ranges

The resolve-ranges goal takes a lot of time processing properties that are used in dependency versions (let's call them version properties) in parent projects . As far as I can tell the only version properties that need to be considered are those occurring in the pom of the current project because those are the only ones that could possibly be updated.

When using a parent with a lot of version properties (eg. spring-boot-dependencies) this leads to execution times of several minutes. This has already been reported for other mojos.

For instance the following pom takes 01:23 min and hits the repository with several hundreds of maven-metadata.xml requests.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>3.3.2</version>
  </parent>
  <artifactId>it-resolve-ranges-issues-todo</artifactId>
  <packaging>pom</packaging>

  <properties>
    <htmlunit.version>[2.6,3)</htmlunit.version>
  </properties>
</project>

Browsing the history of issues and pull requests I see the introduction of 'includeParents' in several mojos and methods (as a solution to for instance #367) to have caused this.

I don't think introduction of the includeParents parameter to the resolve-ranges mojo is the best solution, because as already stated in #837, setting this to false will sometimes lead to incorrect results. Instead, I am preparing a merge request that restricts the properties to consider to those that exist in the current project.

@khmarbaise
Copy link
Member

You should configure the resolution of transitive deps etc. via configuration
https://www.mojohaus.org/versions/versions-maven-plugin/resolve-ranges-mojo.html
And it might be a good idea to ignore the dependencyManagement depending your use case:

            <configuration>
              <processDependencyManagementTransitive>false</processDependencyManagementTransitive>
            </configuration>

@m-schutte-ohra-nl
Copy link
Contributor Author

processDependencyManagementTransitive is not a parameter of the resolve-ranges mojo.

Besides that, the time is spent in handling the properties, not in the dependencyManagement. To be exact, it is spent in the 'while (i.hasNext())' loop in DefaultVersionsHelper.getVersionPropertiesMap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants