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

CI friendly properties break submodule builds

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.9
    • Fix Version/s: 3.5.0-beta-1, 3.5.0
    • Component/s: core
    • Labels:
      None

      Description

      Scenario

      A multi-module project where the parent version is one of the CI friendly properties, e.g. ${revision} as outlined in http://blog.soebes.de/blog/2016/08/08/maven-how-to-create-a-release/.

      There are two submodules submodule1 and submodule2 such that submodule2 depends on submodule1.

      Expected behaviour

      Each submodule can be built by itself, e.g.

      mvn clean install -Drevision=1.0.0-SNAPSHOT -pl submodule2
      

      or

      cd submodule2; mvn clean install -Drevision=1.0.0-SNAPSHOT
      

      Actual behaviour

      This does not work for submodule2 or in general any module that depends on a module from the same reactor.

      Maven cannot resolve the property variable in the referenced parent POM version and fails the build:

      [ERROR] Failed to execute goal on project submodule2: Could not resolve dependencies for project com.example:submodule2:jar:1.0.0-SNAPSHOT: Failed to collect dependencies at com.example:submodule1:jar:1.0.0-SNAPSHOT: Failed to read artifact descriptor for com.example:submodule1:jar:1.0.0-SNAPSHOT: Could not find artifact com.exammple:parent:pom:${revision} -> [Help 1]
      

      There is no problem building submodule1 or the entire reactor.

      Same problem observed with a local build from master (3.4.0-SNAPSHOT).

        Issue Links

          Activity

          Hide
          mfriedenhagen Mirko Friedenhagen added a comment -

          Hello Harald Wellmann,

          Show
          mfriedenhagen Mirko Friedenhagen added a comment - Hello Harald Wellmann , I created a sample project (at https://gitlab.com/mfriedenhagen/mng6090/ ) and could reproduce the behavior, see: https://gitlab.com/mfriedenhagen/mng6090/pipelines/4355078 . There are two CI jobs which firstly install all modules and then try to verify s2 alone (called "first all, then only s2").
          Hide
          khmarbaise Karl Heinz Marbaise added a comment - - edited
          Show
          khmarbaise Karl Heinz Marbaise added a comment - - edited Working version in 82548dbc84bea2e0ab95316c809239dd22433055
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1568 (See https://builds.apache.org/job/maven-3.x/1568/)
          MNG-6090 CI friendly properties break submodule builds MNG-6057 (khmarbaise: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=51cc76c32625be2f807dcf2ffbeb085984729b57)

          • (edit) maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
          • (edit) maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
          • (edit) maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
          • (edit) maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1568 (See https://builds.apache.org/job/maven-3.x/1568/ ) MNG-6090 CI friendly properties break submodule builds MNG-6057 (khmarbaise: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=51cc76c32625be2f807dcf2ffbeb085984729b57 ) (edit) maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java (edit) maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java (edit) maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java (edit) maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
          Hide
          jonwilmoth@yahoo.com Jon Wilmoth added a comment -

          FYI - I still see this broken behavior in 3.5.0 (i.e. cd submodule; mvn clean install results in error that the could not find the parent artifact with a pom:$

          {revision}

          ):

          mvn -v
          Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
          Maven home: /usr/local/Cellar/maven/3.5.0/libexec
          Java version: 1.8.0_144, vendor: Oracle Corporation
          Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre
          Default locale: en_US, platform encoding: UTF-8
          OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"

          Show
          jonwilmoth@yahoo.com Jon Wilmoth added a comment - FYI - I still see this broken behavior in 3.5.0 (i.e. cd submodule; mvn clean install results in error that the could not find the parent artifact with a pom:$ {revision} ): mvn -v Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00) Maven home: /usr/local/Cellar/maven/3.5.0/libexec Java version: 1.8.0_144, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"
          Hide
          jonwilmoth@yahoo.com Jon Wilmoth added a comment -

          Adding the flatten-maven-plugin to the parent pom did allow the submodule to build successfully. The https://maven.apache.org/maven-ci-friendly.html#Install__Deploy section of the docs suggests this is only necessary to support older versions of maven.

          Show
          jonwilmoth@yahoo.com Jon Wilmoth added a comment - Adding the flatten-maven-plugin to the parent pom did allow the submodule to build successfully. The https://maven.apache.org/maven-ci-friendly.html#Install__Deploy section of the docs suggests this is only necessary to support older versions of maven.
          Hide
          khmarbaise Karl Heinz Marbaise added a comment - - edited

          Do not reuse old issues please create a new issue and make a reference to this issue if you need. The docs where not 100% clear in this point. It means you have to use flatten-maven-plugin always otherwise you can not reuse the artifacts correctly...(Fixed the docs.) and best is to ask first on the user mailing list before opening an issue...

          Show
          khmarbaise Karl Heinz Marbaise added a comment - - edited Do not reuse old issues please create a new issue and make a reference to this issue if you need. The docs where not 100% clear in this point. It means you have to use flatten-maven-plugin always otherwise you can not reuse the artifacts correctly...(Fixed the docs.) and best is to ask first on the user mailing list before opening an issue...

            People

            • Assignee:
              khmarbaise Karl Heinz Marbaise
              Reporter:
              hwellmann Harald Wellmann
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development