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

Jenkins does not respect Maven profiles -> so pom module parsing fails

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • None
    • - jenkins + maven plugin 1.438
      - jenkins 1.466.1

      It seems in my Maven2 project jenkins tries to load modules and fails because i haven't checked them out.

      • I have a parent pom.xml with 3 modules in it ( Flat layout )
      • But i let the parent project get checked out
      • The <modules> are specified inside a "modules" profile.
      • The profile is per default active. BUT, it disable it for this build via "-P!modules"

      -> So a manual Maven Build on the commandline works.

      But Jenkins fails, because it tries to load the pom of one of the other modules, which aren't there. Now I cannot build.

      So:

      • Jenkins should respect profile activateino i pass in at "Goals and options".
      • when jenkins internal parsing fails, there is no reason the jenkins build itself fails.

      LOG:

      Parsing POMs
      ERROR: POMs konnten nicht geparst werden
      org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
      [FATAL] Non-readable POM /srv/jenkins/jobs/p1-parent/workspace/p1-parent/../p1-common/pom.xml: /srv/jenkins/jobs/p1-parent/workspace/p1-parent/../p1-common/pom.xml (No such file or directory) @

      at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:339)
      at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)
      at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)
      at hudson.maven.MavenEmbedder.readProject(MavenEmbedder.java:322)
      at hudson.maven.MavenModuleSetBuild$PomParser.readChilds(MavenModuleSetBuild.java:1307)
      at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1214)
      at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1032)
      at hudson.FilePath.act(FilePath.java:785)
      at hudson.FilePath.act(FilePath.java:767)
      at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:897)
      at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:647)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:461)
      at hudson.model.Run.run(Run.java:1404)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:470)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:230)
      Email was triggered for: Failure

          [JENKINS-11695] Jenkins does not respect Maven profiles -> so pom module parsing fails

          kutzi added a comment -

          So the real problem seems to be that profiles are not respected when Jenkins parses the POMs, right? Could please update the title, so this gets more clear?

          Also could you please search for duplicate issues? As, if this is really not working, this is probably already reported.

          kutzi added a comment - So the real problem seems to be that profiles are not respected when Jenkins parses the POMs, right? Could please update the title, so this gets more clear? Also could you please search for duplicate issues? As, if this is really not working, this is probably already reported.

          Rainer Weinhold added a comment - - edited

          This bug still exists in LTS 1.466.1

          Create a new project and copy the attached pom.xml into it.
          Run a maven with "install" -> the build will fail.
          When passing a "-P!modules" to maven the build should not fail, but jenkins does!

          This is because Jenkins doesn't respect profile deactivations/(activations?)

          Error on 1.466.1 with above pom :

          Building remotely on slave1 in workspace /srv/slave/workspace/test
          Parsing POMs
          ERROR: Failed to parse POMs
          hudson.util.IOException2: remote file operation failed: /srv/slave/workspace/test at hudson.remoting.Channel@3d073b94:slave1
          at hudson.FilePath.act(FilePath.java:835)
          at hudson.FilePath.act(FilePath.java:821)
          at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:910)
          at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:654)
          at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480)
          at hudson.model.Run.run(Run.java:1438)
          at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
          at hudson.model.ResourceController.execute(ResourceController.java:88)
          at hudson.model.Executor.run(Executor.java:239)
          Caused by: hudson.remoting.ProxyException: hudson.maven.MavenModuleSetBuild$MavenExecutionException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
          [FATAL] Non-readable POM /srv/slave/workspace/test/sb-testing-common/pom.xml: /srv/slave/workspace/test/sb-testing-common/pom.xml (No such file or directory) @

          at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1278)
          at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1045)
          at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2193)
          at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          at hudson.remoting.Request$2.run(Request.java:326)
          at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:662)
          Caused by: hudson.remoting.ProxyException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
          [FATAL] Non-readable POM /srv/slave/workspace/test/sb-testing-common/pom.xml: /srv/slave/workspace/test/sb-testing-common/pom.xml (No such file or directory) @

          at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363)
          at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)
          at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)
          at hudson.maven.MavenEmbedder.readProject(MavenEmbedder.java:322)
          at hudson.maven.MavenModuleSetBuild$PomParser.readChilds(MavenModuleSetBuild.java:1332)
          at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1239)
          ... 11 more
          Notifying upstream projects of job completion
          Finished: FAILURE

          Rainer Weinhold added a comment - - edited This bug still exists in LTS 1.466.1 Create a new project and copy the attached pom.xml into it. Run a maven with "install" -> the build will fail. When passing a "-P!modules" to maven the build should not fail, but jenkins does! This is because Jenkins doesn't respect profile deactivations/(activations?) Error on 1.466.1 with above pom : Building remotely on slave1 in workspace /srv/slave/workspace/test Parsing POMs ERROR: Failed to parse POMs hudson.util.IOException2: remote file operation failed: /srv/slave/workspace/test at hudson.remoting.Channel@3d073b94:slave1 at hudson.FilePath.act(FilePath.java:835) at hudson.FilePath.act(FilePath.java:821) at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:910) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:654) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480) at hudson.model.Run.run(Run.java:1438) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:239) Caused by: hudson.remoting.ProxyException: hudson.maven.MavenModuleSetBuild$MavenExecutionException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [FATAL] Non-readable POM /srv/slave/workspace/test/sb-testing-common/pom.xml: /srv/slave/workspace/test/sb-testing-common/pom.xml (No such file or directory) @ at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1278) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1045) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2193) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: hudson.remoting.ProxyException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [FATAL] Non-readable POM /srv/slave/workspace/test/sb-testing-common/pom.xml: /srv/slave/workspace/test/sb-testing-common/pom.xml (No such file or directory) @ at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363) at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361) at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331) at hudson.maven.MavenEmbedder.readProject(MavenEmbedder.java:322) at hudson.maven.MavenModuleSetBuild$PomParser.readChilds(MavenModuleSetBuild.java:1332) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1239) ... 11 more Notifying upstream projects of job completion Finished: FAILURE

          Tiago RC added a comment -

          Hello,

          I'm having a weird issue, I wonder if it's related to this open bug.

          I have a build done in several steps. There are 3 maven calls, the first package the artifacts, a second to call run a "JUnit-script" that will populate the integration database, and a final third call that will run all tests.
          The 2nd call must be run with a particular profile, that I activate via -P. The other two calls should not have this profile active.
          But, for a reason that I ignore, the profile remains active during the third maven call.

          I tried using a shell script for the second call, in the hope that it would spawn a second JVM and thus not preserve previous configs, but it did not work.

          Any suggestions, work-around etc?

          Thank you in advance!

          Tiago RC added a comment - Hello, I'm having a weird issue, I wonder if it's related to this open bug. I have a build done in several steps. There are 3 maven calls, the first package the artifacts, a second to call run a "JUnit-script" that will populate the integration database, and a final third call that will run all tests. The 2nd call must be run with a particular profile, that I activate via -P. The other two calls should not have this profile active. But, for a reason that I ignore, the profile remains active during the third maven call. I tried using a shell script for the second call, in the hope that it would spawn a second JVM and thus not preserve previous configs, but it did not work. Any suggestions, work-around etc? Thank you in advance!

          Confirmed with a repository added from a profile and containing an updated parent POM, providing a new dependency in its dependencyManagement.
          The POM parsing fails with "'dependencies.dependency.version' for org.quartz-scheduler:quartz-oracle:jar is missing".

          This error corresponds to not using the profile configured in the job ("qa" in my case):

          $ mvn help:effective-pom -Pqa |grep -C2 quartz-oracle
                <dependency>
                  <groupId>org.quartz-scheduler</groupId>
                  <artifactId>quartz-oracle</artifactId>
                  <version>1.8.6</version>
                </dependency>
          
          $ mvn help:effective-pom  |grep -C2 quartz-oracle
          Validation Messages:
              [0]  'dependencies.dependency.version' is missing for org.quartz-scheduler:quartz-oracle:jar
          

          The suggested workaround, I saw in some mailing list thread, to provide a custom settings which activates the wanted profile doesn't work neither.

          Julien Carsique added a comment - Confirmed with a repository added from a profile and containing an updated parent POM, providing a new dependency in its dependencyManagement. The POM parsing fails with " 'dependencies.dependency.version' for org.quartz-scheduler:quartz-oracle:jar is missing ". This error corresponds to not using the profile configured in the job ("qa" in my case): $ mvn help:effective-pom -Pqa |grep -C2 quartz-oracle <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz-oracle</artifactId> <version>1.8.6</version> </dependency> $ mvn help:effective-pom |grep -C2 quartz-oracle Validation Messages: [0] 'dependencies.dependency.version' is missing for org.quartz-scheduler:quartz-oracle:jar The suggested workaround, I saw in some mailing list thread, to provide a custom settings which activates the wanted profile doesn't work neither.

          Workaround is to control profile activation via a property. The property can be set to true inside the pom and overridden by Jenkins using -D in the goals and options.

          Moti Nisenson-Ken added a comment - Workaround is to control profile activation via a property. The property can be set to true inside the pom and overridden by Jenkins using -D in the goals and options.

            Unassigned Unassigned
            rainerw Rainer Weinhold
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: