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

Continuous Delivery friendly versions break with multi-module projects

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 3.3.9
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      When I have a multi-module maven project, and one of the sub-modules is a mult-module POM itself, the use of a continuous delivery friendly version in the parent <version/> breaks the build from within either sub-module-1 or sub-module-2.

      Some Maven multi-module project like so:

      parent
           + sub-module 1
           |            + child 1-1
           |            |
           |            + child 1-2
           |
           + sub-module 2
                        + child 2-1
      

      In the example build below, I've set Maven to offline mode - this happens when online as well. Specifically, the problem is that Maven is looking for a parent POM with the version set to 1.${revision}, which is incorrect.

      I believe the problem stems from the fact that the value stored in the <parent/> includes the property, which isn't correctly parsed.

      2016-07-16 12:49:59
      rbellamy@terraspark i ~/Development/test-cd-ci-friendly-versions master % mvn -o -DskipTests compile
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Build Order:
      [INFO]
      [INFO] child-1-1
      [INFO] child-1-2
      [INFO] sub-module-1
      [INFO] child-2-1
      [INFO] sub-module-2
      [INFO] test-cd-ci-friendly-versions
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-1-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ child-1-1 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ child-1-1 ---
      [INFO] Changes detected - recompiling the module!
      [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
      [INFO] Compiling 1 source file to /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-1/target/classes
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-1-2 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ child-1-2 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ child-1-2 ---
      [INFO] Changes detected - recompiling the module!
      [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
      [INFO] Compiling 1 source file to /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-2/target/classes
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building sub-module-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-2-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ child-2-1 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ child-2-1 ---
      [INFO] Changes detected - recompiling the module!
      [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
      [INFO] Compiling 1 source file to /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-2/child-2-1/target/classes
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building sub-module-2 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building test-cd-ci-friendly-versions 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO]
      [INFO] child-1-1 .......................................... SUCCESS [  0.756 s]
      [INFO] child-1-2 .......................................... SUCCESS [  0.111 s]
      [INFO] sub-module-1 ....................................... SUCCESS [  0.000 s]
      [INFO] child-2-1 .......................................... SUCCESS [  0.045 s]
      [INFO] sub-module-2 ....................................... SUCCESS [  0.001 s]
      [INFO] test-cd-ci-friendly-versions ....................... SUCCESS [  0.000 s]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.030 s
      [INFO] Finished at: 2016-07-16T12:50:08-07:00
      [INFO] Final Memory: 16M/305M
      [INFO] ------------------------------------------------------------------------
      2016-07-16 12:50:08
      rbellamy@terraspark i ~/Development/test-cd-ci-friendly-versions master % cd sub-module-2
      2016-07-16 12:50:23
      rbellamy@terraspark i ~/Development/test-cd-ci-friendly-versions/sub-module-2 master % mvn -o -DskipTests compile
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Build Order:
      [INFO]
      [INFO] child-2-1
      [INFO] sub-module-2
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-2-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO]
      [INFO] child-2-1 .......................................... FAILURE [  0.091 s]
      [INFO] sub-module-2 ....................................... SKIPPED
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.180 s
      [INFO] Finished at: 2016-07-16T12:50:29-07:00
      [INFO] Final Memory: 8M/309M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal on project child-2-1: Could not resolve dependencies for project com.terradatum:child-2-1:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.terradatum:child-1-2:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for com.terradatum:child-1-2:jar:1.0-SNAPSHOT: Cannot access nexus (https://nexus.terradatum.com/content/groups/public) in offline mode and the artifact com.terradatum:sub-module-1:pom:1.${revision} has not been downloaded from it before. -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
      zsh: exit 1     mvn -o -DskipTests compile
      

      And here's a run with a top-level online install, followed by an attempt to build sub-module-2...

      2016-07-16 12:57:39
      rbellamy@terraspark i ~/Development/test-cd-ci-friendly-versions master % mvn -DskipTests install
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Build Order:
      [INFO]
      [INFO] child-1-1
      [INFO] child-1-2
      [INFO] sub-module-1
      [INFO] child-2-1
      [INFO] sub-module-2
      [INFO] test-cd-ci-friendly-versions
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-1-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ child-1-1 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ child-1-1 ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ child-1-1 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] skip non existing resourceDirectory /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-1/src/test/resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ child-1-1 ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ child-1-1 ---
      [INFO] Tests are skipped.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ child-1-1 ---
      [INFO] Building jar: /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-1/target/child-1-1-1.0-SNAPSHOT.jar
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ child-1-1 ---
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-1/target/child-1-1-1.0-SNAPSHOT.jar to /Users/rbellamy/.m2/repository/com/terradatum/child-1-1/1.0-SNAPSHOT/child-1-1-1.0-SNAPSHOT.jar
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-1/pom.xml to /Users/rbellamy/.m2/repository/com/terradatum/child-1-1/1.0-SNAPSHOT/child-1-1-1.0-SNAPSHOT.pom
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-1-2 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ child-1-2 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ child-1-2 ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ child-1-2 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] skip non existing resourceDirectory /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-2/src/test/resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ child-1-2 ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ child-1-2 ---
      [INFO] Tests are skipped.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ child-1-2 ---
      [INFO] Building jar: /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-2/target/child-1-2-1.0-SNAPSHOT.jar
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ child-1-2 ---
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-2/target/child-1-2-1.0-SNAPSHOT.jar to /Users/rbellamy/.m2/repository/com/terradatum/child-1-2/1.0-SNAPSHOT/child-1-2-1.0-SNAPSHOT.jar
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/child-1-2/pom.xml to /Users/rbellamy/.m2/repository/com/terradatum/child-1-2/1.0-SNAPSHOT/child-1-2-1.0-SNAPSHOT.pom
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building sub-module-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ sub-module-1 ---
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-1/pom.xml to /Users/rbellamy/.m2/repository/com/terradatum/sub-module-1/1.0-SNAPSHOT/sub-module-1-1.0-SNAPSHOT.pom
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-2-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ child-2-1 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ child-2-1 ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ child-2-1 ---
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] skip non existing resourceDirectory /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-2/child-2-1/src/test/resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ child-2-1 ---
      [INFO] Nothing to compile - all classes are up to date
      [INFO]
      [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ child-2-1 ---
      [INFO] Tests are skipped.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ child-2-1 ---
      [INFO] Building jar: /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-2/child-2-1/target/child-2-1-1.0-SNAPSHOT.jar
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ child-2-1 ---
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-2/child-2-1/target/child-2-1-1.0-SNAPSHOT.jar to /Users/rbellamy/.m2/repository/com/terradatum/child-2-1/1.0-SNAPSHOT/child-2-1-1.0-SNAPSHOT.jar
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-2/child-2-1/pom.xml to /Users/rbellamy/.m2/repository/com/terradatum/child-2-1/1.0-SNAPSHOT/child-2-1-1.0-SNAPSHOT.pom
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building sub-module-2 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ sub-module-2 ---
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/sub-module-2/pom.xml to /Users/rbellamy/.m2/repository/com/terradatum/sub-module-2/1.0-SNAPSHOT/sub-module-2-1.0-SNAPSHOT.pom
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building test-cd-ci-friendly-versions 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- maven-install-plugin:2.4:install (default-install) @ test-cd-ci-friendly-versions ---
      [INFO] Installing /Users/rbellamy/Development/test-cd-ci-friendly-versions/pom.xml to /Users/rbellamy/.m2/repository/com/terradatum/test-cd-ci-friendly-versions/1.0-SNAPSHOT/test-cd-ci-friendly-versions-1.0-SNAPSHOT.pom
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO]
      [INFO] child-1-1 .......................................... SUCCESS [  0.783 s]
      [INFO] child-1-2 .......................................... SUCCESS [  0.032 s]
      [INFO] sub-module-1 ....................................... SUCCESS [  0.004 s]
      [INFO] child-2-1 .......................................... SUCCESS [  0.025 s]
      [INFO] sub-module-2 ....................................... SUCCESS [  0.005 s]
      [INFO] test-cd-ci-friendly-versions ....................... SUCCESS [  0.004 s]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.968 s
      [INFO] Finished at: 2016-07-16T13:03:55-07:00
      [INFO] Final Memory: 12M/309M
      [INFO] ------------------------------------------------------------------------
      2016-07-16 13:03:55
      rbellamy@terraspark i ~/Development/test-cd-ci-friendly-versions master % cd sub-module-2
      2016-07-16 13:04:00
      rbellamy@terraspark i ~/Development/test-cd-ci-friendly-versions/sub-module-2 master % mvn -DskipTests compile
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Build Order:
      [INFO]
      [INFO] child-2-1
      [INFO] sub-module-2
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building child-2-1 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      Downloading: https://nexus.terradatum.com/content/groups/public/com/terradatum/sub-module-1/1.$%7Brevision%7D/sub-module-1-1.$%7Brevision%7D.pom
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO]
      [INFO] child-2-1 .......................................... FAILURE [  0.644 s]
      [INFO] sub-module-2 ....................................... SKIPPED
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.733 s
      [INFO] Finished at: 2016-07-16T13:04:08-07:00
      [INFO] Final Memory: 14M/309M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal on project child-2-1: Could not resolve dependencies for project com.terradatum:child-2-1:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.terradatum:child-1-2:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for com.terradatum:child-1-2:jar:1.0-SNAPSHOT: Could not find artifact com.terradatum:sub-module-1:pom:1.${revision} in nexus (https://nexus.terradatum.com/content/groups/public) -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
      zsh: exit 1     mvn -DskipTests compile
      

      Link to reproduction to be added shortly.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                khmarbaise Karl Heinz Marbaise
                Reporter:
                rbellamy@pteradigm.com G. Richard Bellamy
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: