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

Modules of a Maven multimodule-build are not marked as FAILED/FAILURE in Hudson when dependencies cannot be resolved

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • maven-plugin
    • None
    • Maven 2 (does work with maven 3)

      If a Module of a multimodule Maven build fails during compile it is marked as FAILED in the reactor summary (end of the build). If a module fails due to nonresolvable dependencies (for example version that does not exist), it is marked as FAILED in the reactor summary, but in Hudson it gets the status SUCCESS (job.getBuildByNumber(number).getResult() == Result.SUCCESS) instead of FAILURE.

      Hudson console (reactor summary):

      [Info] TestProject3 ...................................... FAILED [0.244s]

      Plugin code:

      job.getBuildByNumber(number).getResult().toString() => SUCCESS

          [JENKINS-7036] Modules of a Maven multimodule-build are not marked as FAILED/FAILURE in Hudson when dependencies cannot be resolved

          kutzi added a comment -

          Would be good if you could attach a minimal project to reproduce the problem.

          Also: pull requests are welcome

          kutzi added a comment - Would be good if you could attach a minimal project to reproduce the problem. Also: pull requests are welcome

          kutzi added a comment -

          Without further info we cannot fix it.

          kutzi added a comment - Without further info we cannot fix it.

          dtriphaus added a comment -

          There is no need for a special project to reproduce this, you can just use ANY multimodule project and just have to use a dependency with a non-existent version (so build fails during dependency analyzing). Then the console output says the project failed (see above description). But in the plugin code, using job.getBuildByNumber(currentBuildNumber).getResult().toString() returns SUCCESS. So programatically the plugin cannot determine wether the build failed or not. So in fact to test this you don't need a special maven project, just a multimodule build with 2 module (for example) and one module uses a non-existent dependency-version (i.e. log4j 3.0.0). Does this help you as further info?

          dtriphaus added a comment - There is no need for a special project to reproduce this, you can just use ANY multimodule project and just have to use a dependency with a non-existent version (so build fails during dependency analyzing). Then the console output says the project failed (see above description). But in the plugin code, using job.getBuildByNumber(currentBuildNumber).getResult().toString() returns SUCCESS. So programatically the plugin cannot determine wether the build failed or not. So in fact to test this you don't need a special maven project, just a multimodule build with 2 module (for example) and one module uses a non-existent dependency-version (i.e. log4j 3.0.0). Does this help you as further info?

          dtriphaus added a comment -

          well, maybe i can create a minimal plugin so you can reproduce this (just a plugin that produces some output). I'll see if I get some time for that in the near future!

          dtriphaus added a comment - well, maybe i can create a minimal plugin so you can reproduce this (just a plugin that produces some output). I'll see if I get some time for that in the near future!

          dtriphaus added a comment - - edited

          (deleted accidentially duplicate comment)

          dtriphaus added a comment - - edited (deleted accidentially duplicate comment)

          kutzi added a comment -

          Ah, okay. Now I understand what you meant. The module with the wrong dependency itself is not marked as failed while the whole multi-module project is.

          BTW: when building with Maven 3 it works as expected.

          kutzi added a comment - Ah, okay. Now I understand what you meant. The module with the wrong dependency itself is not marked as failed while the whole multi-module project is. BTW: when building with Maven 3 it works as expected.

          kutzi added a comment -

          I tried to figure out how to pass a ExecutionListener to the Maven2 launcher, the same way as it's done in Maven 3.

          However, I have to admit that my understanding about the lauchning process is far too limited to fix it.

          Assigning to olamy to see, if he can help out.

          kutzi added a comment - I tried to figure out how to pass a ExecutionListener to the Maven2 launcher, the same way as it's done in Maven 3. However, I have to admit that my understanding about the lauchning process is far too limited to fix it. Assigning to olamy to see, if he can help out.

          Olivier Lamy added a comment -

          any sample project to reproduce the issue ?

          Olivier Lamy added a comment - any sample project to reproduce the issue ?

          kutzi added a comment -

          This project reproduces the issue - it has an unresolvable dependency in submodule child1

          kutzi added a comment - This project reproduces the issue - it has an unresolvable dependency in submodule child1

          dtriphaus added a comment -

          The TestPlugin.hpi creates some output to System.out ->

          01.09.2011 13:33:58 hudson.model.Run run
          INFO: mm1 » child2 #1 main build action completed: NOT_BUILT
          01.09.2011 13:33:58 hudson.model.Run run
          INFO: mm1 #1 main build action completed: FAILURE
          OUTPUT: Project: com.test1:parent – Status: SUCCESS
          OUTPUT: Project: com.test1:child1 – Status: SUCCESS
          OUTPUT: Project: com.test1:child2 – Status: NOT_BUILT

          Basically it's this output:
          String.format("Project: %s – Status: %s", job.getName(), job.getBuildByNumber(number).getResult().toString());

          You just need to activate "TestPlugin active?" checkbox in job configuration "post build actions". As you see child1 is telling "success" but we got the failure with log4j ...

          dtriphaus added a comment - The TestPlugin.hpi creates some output to System.out -> 01.09.2011 13:33:58 hudson.model.Run run INFO: mm1 » child2 #1 main build action completed: NOT_BUILT 01.09.2011 13:33:58 hudson.model.Run run INFO: mm1 #1 main build action completed: FAILURE OUTPUT: Project: com.test1:parent – Status: SUCCESS OUTPUT: Project: com.test1:child1 – Status: SUCCESS OUTPUT: Project: com.test1:child2 – Status: NOT_BUILT Basically it's this output: String.format("Project: %s – Status: %s", job.getName(), job.getBuildByNumber(number).getResult().toString()); You just need to activate "TestPlugin active?" checkbox in job configuration "post build actions". As you see child1 is telling "success" but we got the failure with log4j ...

            Unassigned Unassigned
            dtriphaus dtriphaus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: