Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6412

Exceeding project discovery time when using CI friendly versions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.5.3
    • 3.6.0
    • None
    • None

    Description

      We are switching a larger project to CI friendly versions (https://maven.apache.org/maven-ci-friendly.html), using properties ${revision} (fix) and ${changelist} (maps to the CI build number) to create the actual version. However, doing so, the project discovery time (right after Maven says “Scanning for projects...”) increases dramatically from few seconds to more than 3 minutes, and we had to double the maximum heap in order to avoid “GC overhead limit exceeded” exception.

      The project root POM looks like this:

        <groupId>test</groupId>
        <artifactId>parent</artifactId>
        <version>${revision}-${changelist}</version>
        <packaging>pom</packaging>
        ...
        <properties>
          <revision>1.0.0</revision>
          <changelist>UNDEFINED</changelist>
        </properties> 

      and is built by passing “-Dchangelist=123” to the Maven process for CI build 123, for instance.

      In debug output, we can see that for each POM of the reactor there are messages like these, repeatedly for every single parent POM up the complete hierarchy:

      [DEBUG] Extension realms for project test:grandchild1-1:jar:1.0.0-123: (none)
      [DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
      [DEBUG] Extension realms for project test:child1:pom:1.0.0-123: (none)
      [DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
      [DEBUG] Extension realms for project test:parent:pom:1.0.0-123: (none)
      [DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
      

      When using fix version string (release or SNAPSHOT), these messages are only present for the reactor POMs, but not their parents, grand-parents, etc. up to the root POM.

      Looking up the lifecycle mapping for the same parent POMs over and over again seems wrong to me, and is probably the cause of high memory consumption. Altogether, there are more than 2,800 messages "Looking up lifecycle mappings..." in the logs for about 350 subprojects built in the reactor!

      See attached test projects and logs for fix version vs. CI friendly versions. The test project structure is like this:

      parent
        child1
          grandchild1-1
          grandchild1-2
        child2
          grandchild2-1
          grandchild2-2

      If you compare both log files, you'll see the difference in project resolving.

      Attachments

        1. ci-version-validate.log
          19 kB
          Christoph Amshoff
        2. fix-version-validate.log
          18 kB
          Christoph Amshoff
        3. test-ci-project-scanning.zip
          7 kB
          Christoph Amshoff

        Issue Links

          Activity

            People

              slachiewicz Sylwester Lachiewicz
              chamshoff Christoph Amshoff
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: