Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8390

POMs parsing fails in m2 projects which has a wrong inheritence (m3 constraint)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • maven-plugin
    • None

      It occurs with Hudson ver. 1.393-SNAPSHOT (private-01/01/2011 21:34-olamy) but probably also with latest 1.392
      The test case is simple.
      A project with a parent like this :

      <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/maven-v4_0_0.xsd">
              <modelVersion>4.0.0</modelVersion>
              <groupId>org.hudson-ci.testcase</groupId>
              <artifactId>wrong-inheritence-parent</artifactId>
              <version>1.0-SNAPSHOT</version>
              <packaging>pom</packaging>
              <modules>
                      <module>subdir/mod1</module>
              </modules>
      </project>
      

      And in the module subdir/mod1

      <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/maven-v4_0_0.xsd">
              <modelVersion>4.0.0</modelVersion>
              <parent>
                      <groupId>org.hudson-ci.testcase</groupId>
                      <artifactId>wrong-inheritence-parent</artifactId>
                      <version>1.0-SNAPSHOT</version>
              </parent>
              <artifactId>wrong-inheritence-module</artifactId>
              <packaging>jar</packaging>
      </project>
      

      Not that there is no module in subdir and mod1 doesn't say where to find its parent with a relative path.
      Such a build passes with M2 and fails with m3 with an error like :

      [ERROR] The build could not read 1 project -> [Help 1]
      [ERROR]   
      [ERROR]   The project org.hudson-ci.testcase:wrong-inheritence-module:1.0-SNAPSHOT (/Users/arnaud/Code/Hudson/incorrect-inheritence-testcase/subdir/mod1/pom.xml) has 1 error
      [ERROR]     Non-resolvable parent POM: Could not find artifact org.hudson-ci.testcase:wrong-inheritence-parent:pom:1.0-SNAPSHOT in exo-fr-mirror (http://repository.exoplatform.org/public) and 'parent.relativePath' points at wrong local POM @ line 4, column 17 -> [Help 2]
      

      The issue with using m3 to parse m2 projects is that some builds that passed previously (because it was allowed by m2) doesn't work anymore.
      I attach a testcase

          [JENKINS-8390] POMs parsing fails in m2 projects which has a wrong inheritence (m3 constraint)

          Another M3 error blocking M2 projects in the parsing phase :

          ERROR: Failed to parse POMs
          org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
          [ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.scope' for org.codehaus.cargo:cargo-core-uberjar:jar must be one of [compile, runtime, system] but is 'test'. @ line 275, column 26
          
          	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:325)
          	at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:342)
          	at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1083)
          	at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:983)
          	at hudson.FilePath.act(FilePath.java:756)
          	at hudson.FilePath.act(FilePath.java:738)
          	at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:690)
          	at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:526)
          	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:417)
          	at hudson.model.Run.run(Run.java:1362)
          	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:400)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:145)
          

          Arnaud Héritier added a comment - Another M3 error blocking M2 projects in the parsing phase : ERROR: Failed to parse POMs org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.scope' for org.codehaus.cargo:cargo-core-uberjar:jar must be one of [compile, runtime, system] but is 'test' . @ line 275, column 26 at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:325) at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:342) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1083) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:983) at hudson.FilePath.act(FilePath.java:756) at hudson.FilePath.act(FilePath.java:738) at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:690) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:526) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:417) at hudson.model.Run.run(Run.java:1362) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:400) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145)

          Olivier Lamy added a comment - - edited

          need more workaround

          Olivier Lamy added a comment - - edited need more workaround

          ndg added a comment -

          Same problem on the 1.392 version. Did an update of hudson and the error in comment above came up.

          ndg added a comment - Same problem on the 1.392 version. Did an update of hudson and the error in comment above came up.

          Olivier Lamy added a comment -

          Olivier Lamy added a comment - fixed https://github.com/hudson/hudson/commit/b84efb908f5c5d80959d16300d22fac312109ac3 . ONLY for maven2 builds build deployed here : http://people.apache.org/~olamy/hudson/main-maven3-support/

          Code changed in hudson
          User: Olivier Lamy
          Path:
          maven-plugin/src/main/java/hudson/maven/MavenEmbedderRequest.java
          maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
          maven-plugin/src/main/java/hudson/maven/MavenUtil.java
          test/src/test/java/hudson/maven/Maven3BuildTest.java
          test/src/test/java/hudson/maven/MavenBuildTest.java
          test/src/test/resources/hudson/maven/incorrect-inheritence-testcase.zip
          http://hudson-labs.org/commit/core/b84efb908f5c5d80959d16300d22fac312109ac3
          Log:
          JENKINS-8390 POMs parsing fails in m2 projects which has a wrong inheritence (m3 constraint)
          add a workaround ONLY for maven2 builds

          SCM/JIRA link daemon added a comment - Code changed in hudson User: Olivier Lamy Path: maven-plugin/src/main/java/hudson/maven/MavenEmbedderRequest.java maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java maven-plugin/src/main/java/hudson/maven/MavenUtil.java test/src/test/java/hudson/maven/Maven3BuildTest.java test/src/test/java/hudson/maven/MavenBuildTest.java test/src/test/resources/hudson/maven/incorrect-inheritence-testcase.zip http://hudson-labs.org/commit/core/b84efb908f5c5d80959d16300d22fac312109ac3 Log: JENKINS-8390 POMs parsing fails in m2 projects which has a wrong inheritence (m3 constraint) add a workaround ONLY for maven2 builds

          Code changed in hudson
          User: Olivier Lamy
          Path:
          changelog.html
          http://hudson-labs.org/commit/core/dacf6f3271f744c8d72ade21c59e463233f93c35
          Log:
          update changelog for JENKINS-8390

          SCM/JIRA link daemon added a comment - Code changed in hudson User: Olivier Lamy Path: changelog.html http://hudson-labs.org/commit/core/dacf6f3271f744c8d72ade21c59e463233f93c35 Log: update changelog for JENKINS-8390

            olamy Olivier Lamy
            aheritier Arnaud Héritier
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: