Maven 2 & 3
  1. Maven 2 & 3
  2. MNG-4574

[regression] invoker:install uses wrong local repo path when settings.xml contains wildcard mirror

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0-alpha-6
    • Fix Version/s: 3.0-alpha-7
    • Component/s: None
    • Labels:
      None
    • Environment:
      MacOS 10.6.2 with Maven 3.0-alpha6
    • Complexity:
      Intermediate
    • Number of attachments :
      8

      Description

      I'm coding on an archetype project (http://github.com/sonatype/sonatype-archetype) and am using the install goal of Invoker 1.5. If I use an alternate repo with the <localRepositoryUrl>, the archetype JAR is not copied into the local repo location. If I use Maven 2.2.1, the resource is copied into the localRepositoryUrl location with no problem.

      I've commented out the <install> and <localRepositoryUrl> tags in the committed version so that it passes when built with Maven 3.0-alpha-6.

      File:
      http://github.com/sonatype/sonatype-archetype/blob/master/archetype-archetypes/quickstart/pom.xml

      To reproduce this.
      1) Download Maven 3.0-alpha-6
      2) Set it to be your active maven version
      3) git clone git@github.com:sonatype/sonatype-archetype.git
      4) Hijack and uncomment the <goal>install</goal> and <localRepositoryPath>$

      {project.build.directory}

      /it/repo</localRepositoryPath> in the file archetype-archetypes/quickstart/pom.xml
      5) build the entire source tree with "mvn install"
      5) It will fail with the following error:

      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] [INFO] BUILD FAILURE
      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] [INFO] Total time: 15.576s
      [INFO] [INFO] Finished at: Mon Feb 15 19:49:33 MST 2010
      [INFO] [INFO] Final Memory: 6M/80M
      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.sonatype.maven.archetype:quickstart:0.8.4-SNAPSHOT) -> [Help 1]
      [INFO] [ERROR]
      [INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [INFO] [ERROR]
      [INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
      [INFO] ..FAILED (16.8 s)
      [INFO] The build exited with code 1. See /Users/mccm06/Documents/Code/OpenSourceContribs/sonatype-archetype_git/archetype-archetypes/quickstart/target/it/projects/quickstart/build.log for details.
      [INFO] -------------------------------------------------
      [INFO] Build Summary:
      [INFO] Passed: 0, Failed: 1, Errors: 0, Skipped: 0
      [INFO] -------------------------------------------------
      [ERROR] The following builds failed:
      [ERROR] * quickstart
      [INFO] -------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 21.310s
      [INFO] Finished at: Mon Feb 15 19:49:34 MST 2010
      [INFO] Final Memory: 8M/80M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:1.5:run (integration-test) on project quickstart: 1 build failed. -> [Help 1]

      1. Maven2MainBuild.log
        162 kB
        Matthew McCullough
      2. Maven2Success_build.log
        19 kB
        Matthew McCullough
      3. Maven2Success_BUILD-quickstart.xml
        0.1 kB
        Matthew McCullough
      4. Maven3Failure_build.log
        18 kB
        Matthew McCullough
      5. Maven3Failure_BUILD-quickstart.xml
        0.3 kB
        Matthew McCullough
      6. Maven3MainBuild.log
        182 kB
        Matthew McCullough
      7. settings.xml
        3 kB
        Matthew McCullough

        Issue Links

          Activity

          Hide
          Benjamin Bentmann added a comment -

          I couldn't reproduce this easily. Could you please attach full debugs logs of the main build and the failing IT?

          Show
          Benjamin Bentmann added a comment - I couldn't reproduce this easily. Could you please attach full debugs logs of the main build and the failing IT?
          Hide
          Matthew McCullough added a comment -

          I'm attaching a zip file of a sample project that fails the IT under Maven 3.0-alpha-6 but succeeds under 2.2.1. Just unzip it and run mvn install with each version of maven. I'm also attaching the requested logs named accordingly.

          Show
          Matthew McCullough added a comment - I'm attaching a zip file of a sample project that fails the IT under Maven 3.0-alpha-6 but succeeds under 2.2.1. Just unzip it and run mvn install with each version of maven. I'm also attaching the requested logs named accordingly.
          Hide
          Matthew McCullough added a comment -

          Integration test that fails under Maven 3, but succeeds under Maven 2.2.1

          Show
          Matthew McCullough added a comment - Integration test that fails under Maven 3, but succeeds under Maven 2.2.1
          Hide
          Matthew McCullough added a comment -

          Log files from a successful run of the IT under Maven 2.2.1

          Show
          Matthew McCullough added a comment - Log files from a successful run of the IT under Maven 2.2.1
          Hide
          Matthew McCullough added a comment -

          Log file from a failed run of the IT under Maven 3.0-alpha-6

          Show
          Matthew McCullough added a comment - Log file from a failed run of the IT under Maven 3.0-alpha-6
          Hide
          Matthew McCullough added a comment -

          The core (console, redirected) build logs on Maven 3 and 2 for comparison's sake.

          Show
          Matthew McCullough added a comment - The core (console, redirected) build logs on Maven 3 and 2 for comparison's sake.
          Hide
          Benjamin Bentmann added a comment -

          Thanks for the example project and the logs. This seems wrong

          [INFO] Installing [...] to /org/sonatype/maven/archetype/quickstartBROKENIT/0.8.4-SNAPSHOT/quickstartBROKENIT-0.8.4-SNAPSHOT.pom
          [INFO] Installing [...] to /org/sonatype/maven/archetype/quickstartBROKENIT/0.8.4-SNAPSHOT/quickstartBROKENIT-0.8.4-SNAPSHOT.jar
          

          the destination paths are supposed to be absolute and hence should be prefixed with /Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo.

          Show
          Benjamin Bentmann added a comment - Thanks for the example project and the logs. This seems wrong [INFO] Installing [...] to /org/sonatype/maven/archetype/quickstartBROKENIT/0.8.4-SNAPSHOT/quickstartBROKENIT-0.8.4-SNAPSHOT.pom [INFO] Installing [...] to /org/sonatype/maven/archetype/quickstartBROKENIT/0.8.4-SNAPSHOT/quickstartBROKENIT-0.8.4-SNAPSHOT.jar the destination paths are supposed to be absolute and hence should be prefixed with /Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo .
          Hide
          Matthew McCullough added a comment - - edited

          Benjamin - When you say wrong, can you be more specific? I'm not quite following where I should be looking to fix this yet.

          In the pom.xml, I have this parameter specified as {{<localRepositoryPath>$

          {project.build.directory}/it/repo</localRepositoryPath>}} which should resolve at POM interpolation time, right? If I look at the localRepositoryPath parameter passed in to the invoker plugin in the Maven3MainBuild.log file attached earlier, I see it fully resolved to the complete path /Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo:

          [DEBUG] -----------------------------------------------------------------------
          [DEBUG] Goal: org.apache.maven.plugins:maven-invoker-plugin:1.5:install (integration-test)
          [DEBUG] Style: Regular
          [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
          <configuration>
          <localRepository>${localRepository}</localRepository>
          <localRepositoryPath>/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo</localRepositoryPath>
          <project>${project}</project>
          <reactorProjects default-value="${reactorProjects}"/>
          <skipInstallation default-value="false">${invoker.skip}</skipInstallation>
          </configuration>
          [DEBUG] -----------------------------------------------------------------------
          [DEBUG] Goal: org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:integration-test (default-integration-test)
          [DEBUG] Style: Regular
          [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
          <configuration>
          <project>${project}</project>
          <skip>${archetype.test.skip}</skip>
          </configuration>
          [DEBUG] -----------------------------------------------------------------------
          [DEBUG] Goal: org.apache.maven.plugins:maven-invoker-plugin:1.5:run (integration-test)
          [DEBUG] Style: Regular
          [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
          <configuration>
          <addTestClassPath default-value="false">${invoker.addTestClassPath}</addTestClassPath>
          <cloneAllFiles default-value="false"/>
          <cloneProjectsTo>/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/projects</cloneProjectsTo>
          <debug default-value="false">${invoker.debug}</debug>
          <disableReports default-value="false">${invoker.disableReports}</disableReports>
          <encoding default-value="${project.build.sourceEncoding}">${encoding}</encoding>
          <goals>
          <goal>org.apache.maven.plugins:maven-archetype-plugin:generate</goal>
          </goals>
          <goalsFile default-value="goals.txt">${invoker.goalsFile}</goalsFile>
          <ignoreFailures default-value="false">${maven.test.failure.ignore}</ignoreFailures>
          <invokerPropertiesFile default-value="invoker.properties">${invoker.invokerPropertiesFile}</invokerPropertiesFile>
          <invokerTest>${invoker.test}</invokerTest>
          <javaHome>${invoker.javaHome}</javaHome>
          <localRepositoryPath default-value="${settings.localRepository}">/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo</localRepositoryPath>
          <mavenHome>${invoker.mavenHome}</mavenHome>
          <mavenOpts>${invoker.mavenOpts}</mavenOpts>
          <noLog default-value="false">${invoker.noLog}</noLog>
          <pom>${invoker.pom}</pom>
          <pomIncludes>
          <pomInclude>*</pomInclude>
          </pomIncludes>
          <postBuildHookScript default-value="postbuild">${invoker.postBuildHookScript}</postBuildHookScript>
          <preBuildHookScript default-value="prebuild">${invoker.preBuildHookScript}</preBuildHookScript>
          <profilesFile default-value="profiles.txt">${invoker.profilesFile}</profilesFile>
          <project>${project}</project>
          <projectsDirectory default-value="${basedir}/src/it/">/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/src/it/projects</projectsDirectory>
          <properties>
          <archetypeArtifactId>quickstartBROKENIT</archetypeArtifactId>
          <archetypeGroupId>org.sonatype.maven.archetype</archetypeGroupId>
          <archetypeRepository>local</archetypeRepository>
          <archetypeVersion>0.8.4-SNAPSHOT</archetypeVersion>
          <goals>install</goals>
          <interactiveMode>false</interactiveMode>
          </properties>
          <reportsDirectory default-value="${project.build.directory}

          /invoker-reports">$

          {invoker.reportsDirectory}

          </reportsDirectory>
          <selectorScript default-value="selector">$

          {invoker.selectorScript}

          </selectorScript>
          <settings>$

          {settings}

          </settings>
          <settingsFile>$

          {invoker.settingsFile}

          </settingsFile>
          <showErrors default-value="false">$

          {invoker.showErrors}

          </showErrors>
          <showVersion default-value="false">$

          {invoker.showVersion}

          </showVersion>
          <skipInvocation default-value="false">$

          {invoker.skip}

          </skipInvocation>
          <streamLogs default-value="false">true</streamLogs>
          <suppressSummaries default-value="false"/>
          <testClassPath default-value="$

          {project.testClasspathElements}

          "/>
          <testPropertiesFile default-value="test.properties">$

          {invoker.testPropertiesFile}

          </testPropertiesFile>
          </configuration>

          Show
          Matthew McCullough added a comment - - edited Benjamin - When you say wrong, can you be more specific? I'm not quite following where I should be looking to fix this yet. In the pom.xml, I have this parameter specified as {{<localRepositoryPath>$ {project.build.directory}/it/repo</localRepositoryPath>}} which should resolve at POM interpolation time, right? If I look at the localRepositoryPath parameter passed in to the invoker plugin in the Maven3MainBuild.log file attached earlier, I see it fully resolved to the complete path /Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo : [DEBUG] ----------------------------------------------------------------------- [DEBUG] Goal: org.apache.maven.plugins:maven-invoker-plugin:1.5:install (integration-test) [DEBUG] Style: Regular [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?> <configuration> <localRepository>${localRepository}</localRepository> <localRepositoryPath>/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo</localRepositoryPath> <project>${project}</project> <reactorProjects default-value="${reactorProjects}"/> <skipInstallation default-value="false">${invoker.skip}</skipInstallation> </configuration> [DEBUG] ----------------------------------------------------------------------- [DEBUG] Goal: org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:integration-test (default-integration-test) [DEBUG] Style: Regular [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?> <configuration> <project>${project}</project> <skip>${archetype.test.skip}</skip> </configuration> [DEBUG] ----------------------------------------------------------------------- [DEBUG] Goal: org.apache.maven.plugins:maven-invoker-plugin:1.5:run (integration-test) [DEBUG] Style: Regular [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?> <configuration> <addTestClassPath default-value="false">${invoker.addTestClassPath}</addTestClassPath> <cloneAllFiles default-value="false"/> <cloneProjectsTo>/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/projects</cloneProjectsTo> <debug default-value="false">${invoker.debug}</debug> <disableReports default-value="false">${invoker.disableReports}</disableReports> <encoding default-value="${project.build.sourceEncoding}">${encoding}</encoding> <goals> <goal>org.apache.maven.plugins:maven-archetype-plugin:generate</goal> </goals> <goalsFile default-value="goals.txt">${invoker.goalsFile}</goalsFile> <ignoreFailures default-value="false">${maven.test.failure.ignore}</ignoreFailures> <invokerPropertiesFile default-value="invoker.properties">${invoker.invokerPropertiesFile}</invokerPropertiesFile> <invokerTest>${invoker.test}</invokerTest> <javaHome>${invoker.javaHome}</javaHome> <localRepositoryPath default-value="${settings.localRepository}">/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/target/it/repo</localRepositoryPath> <mavenHome>${invoker.mavenHome}</mavenHome> <mavenOpts>${invoker.mavenOpts}</mavenOpts> <noLog default-value="false">${invoker.noLog}</noLog> <pom>${invoker.pom}</pom> <pomIncludes> <pomInclude>*</pomInclude> </pomIncludes> <postBuildHookScript default-value="postbuild">${invoker.postBuildHookScript}</postBuildHookScript> <preBuildHookScript default-value="prebuild">${invoker.preBuildHookScript}</preBuildHookScript> <profilesFile default-value="profiles.txt">${invoker.profilesFile}</profilesFile> <project>${project}</project> <projectsDirectory default-value="${basedir}/src/it/">/Users/mccm06/Documents/Temp/Scratch/quickstart-itbrokenonmaven3/src/it/projects</projectsDirectory> <properties> <archetypeArtifactId>quickstartBROKENIT</archetypeArtifactId> <archetypeGroupId>org.sonatype.maven.archetype</archetypeGroupId> <archetypeRepository>local</archetypeRepository> <archetypeVersion>0.8.4-SNAPSHOT</archetypeVersion> <goals>install</goals> <interactiveMode>false</interactiveMode> </properties> <reportsDirectory default-value="${project.build.directory} /invoker-reports">$ {invoker.reportsDirectory} </reportsDirectory> <selectorScript default-value="selector">$ {invoker.selectorScript} </selectorScript> <settings>$ {settings} </settings> <settingsFile>$ {invoker.settingsFile} </settingsFile> <showErrors default-value="false">$ {invoker.showErrors} </showErrors> <showVersion default-value="false">$ {invoker.showVersion} </showVersion> <skipInvocation default-value="false">$ {invoker.skip} </skipInvocation> <streamLogs default-value="false">true</streamLogs> <suppressSummaries default-value="false"/> <testClassPath default-value="$ {project.testClasspathElements} "/> <testPropertiesFile default-value="test.properties">$ {invoker.testPropertiesFile} </testPropertiesFile> </configuration>
          Hide
          Benjamin Bentmann added a comment -

          I didn't mean the plugin configuration which looks fine but the mere log from Maven 3. For a reason I haven't investigated yet, the path to the test local repo is not correct, hence the artifact isn't found by the IT.

          Show
          Benjamin Bentmann added a comment - I didn't mean the plugin configuration which looks fine but the mere log from Maven 3. For a reason I haven't investigated yet, the path to the test local repo is not correct, hence the artifact isn't found by the IT.
          Hide
          Benjamin Bentmann added a comment - - edited

          I'm not able to reproduce this on either WinXP, Ubuntu or Mac OS X. Could you or a colleague please try this example project on some other machines/platforms to investigate environmental issues?

          Show
          Benjamin Bentmann added a comment - - edited I'm not able to reproduce this on either WinXP, Ubuntu or Mac OS X. Could you or a colleague please try this example project on some other machines/platforms to investigate environmental issues?
          Hide
          Benjamin Bentmann added a comment -

          Alternatively, debug this on your own machine by checking out the 3.0-alpha-6 tag into the IDE and set breakpoints at MavenArtifactRepository.java:77 (URL -> basedir conversion) and DefaultArtifactInstaller.java:74 ff. (artifact path calculation).

          Show
          Benjamin Bentmann added a comment - Alternatively, debug this on your own machine by checking out the 3.0-alpha-6 tag into the IDE and set breakpoints at MavenArtifactRepository.java:77 (URL -> basedir conversion) and DefaultArtifactInstaller.java:74 ff. (artifact path calculation).
          Hide
          Matthew McCullough added a comment -

          Worked on Windows. Still fails on Mac. I'll set the breakpoint on Mac and see what I can see...

          Show
          Matthew McCullough added a comment - Worked on Windows. Still fails on Mac. I'll set the breakpoint on Mac and see what I can see...
          Hide
          Matthew McCullough added a comment -

          Aha! I was able to reproduce it. It is affected by my settings.xml file, which I am attaching. If I have NO settings.xml file, it works fine, even on a Mac. If I use the attached settings.xml file, it fails as previously described. Can you reopen it?

          Show
          Matthew McCullough added a comment - Aha! I was able to reproduce it. It is affected by my settings.xml file, which I am attaching. If I have NO settings.xml file, it works fine, even on a Mac. If I use the attached settings.xml file, it fails as previously described. Can you reopen it?
          Hide
          Matthew McCullough added a comment -

          If I remove the <profiles> and <mirrors> section of the attached POM, then the failure goes away. If I add those sections back, it fails as previously described.

          Show
          Matthew McCullough added a comment - If I remove the <profiles> and <mirrors> section of the attached POM, then the failure goes away. If I add those sections back, it fails as previously described.
          Hide
          Benjamin Bentmann added a comment -

          Fixed in r917315.

          Show
          Benjamin Bentmann added a comment - Fixed in r917315 .

            People

            • Assignee:
              Benjamin Bentmann
              Reporter:
              Matthew McCullough
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: