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

Upgrade apache maven-invoker-plugin to support new buildlog attribute in reports

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • maven-invoker-plugin
    • None
    • Jenkins 2.289 running in docker
      Maven-invoker-plugin 2.4 (Jenkins)
      maven-invoker-plugin 3.2.2 (Apache)

      I get this stack in Jenkins logs :

      org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unknown attribute 'buildlog' for tag 'build-job' (position: START_TAG seen .../project/target/it/dockerfile/build.log">... @2:218) 
      	at org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader.checkUnknownAttribute(BuildJobXpp3Reader.java:119)
      	at org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader.parseBuildJob(BuildJobXpp3Reader.java:652)
      	at org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader.read(BuildJobXpp3Reader.java:698)
      	at org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader.read(BuildJobXpp3Reader.java:553)
      	at org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader.read(BuildJobXpp3Reader.java:567)
      	at org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader.read(BuildJobXpp3Reader.java:596)
      	at org.jenkinsci.plugins.maveninvoker.MavenInvokerRecorder.parseReports(MavenInvokerRecorder.java:191)
      	at org.jenkinsci.plugins.maveninvoker.MavenInvokerRecorder.perform(MavenInvokerRecorder.java:135)
      Caused: java.io.IOException: Unknown attribute 'buildlog' for tag 'build-job' (position: START_TAG seen .../project/target/it/dockerfile/build.log">... @2:218) 
      	at org.jenkinsci.plugins.maveninvoker.MavenInvokerRecorder.perform(MavenInvokerRecorder.java:152)
      	at org.jenkinsci.plugins.maveninvoker.MavenInvokerRecorder.perform(MavenInvokerRecorder.java:119)
      	at org.jenkinsci.plugins.pipeline.maven.publishers.InvokerRunsPublisher.executeReporter(InvokerRunsPublisher.java:141)
      	at org.jenkinsci.plugins.pipeline.maven.publishers.InvokerRunsPublisher.process(InvokerRunsPublisher.java:110)
      	at org.jenkinsci.plugins.pipeline.maven.MavenSpyLogProcessor.processMavenSpyLogs(MavenSpyLogProcessor.java:153)
      	at org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2$WithMavenStepExecutionCallBack.finished(WithMavenStepExecution2.java:1103)
      	at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution$TailCall.lambda$onSuccess$0(GeneralNonBlockingStepExecution.java:140)
      	at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(GeneralNonBlockingStepExecution.java:77)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      and test results are not reported to the GUI

          [JENKINS-65459] Upgrade apache maven-invoker-plugin to support new buildlog attribute in reports

          Vincent Massol added a comment - - edited

          Hi olamy!

          We're hitting this issue on the XWiki project. We suddenly started seeing failed builds on ci.xwiki.org recently, even when everything was ok. After analyzing it we found that the Jenkins InvokerRun publisher now fails the build when there's an error: https://github.com/jenkinsci/pipeline-maven-plugin/commit/08f725b927d9ee934aeaea1f372e3562510d5a28#diff-07a0326a979930635b0f3f4bb291db752d478b8885ff7c76a5741ac866879804R146

          Our error is:

          289397 ERROR: [withMaven] invokerPublisher - exception archiving Invoker runs for Maven artifact MavenArtifact{org.xwiki.platform:xwiki-platform-tool-packager-plugin:maven-plugin:14.10.5-SNAPSHOT(       version: 14.10.5-SNAPSHOT, snapshot:true) } generated by PluginInvocation{org.apache.maven.plugins:maven-invoker-plugin:3.3.0@run  integration-test}: java.io.IOException: Unknown attribute        'buildlog' for tag 'build-job' (position: START_TAG seen ...m-tool-packager-plugin/target/it/basic-import-export/build.log" />... @2:263) . Failing the build.
          

          This looks like this issue and an error of the Jenkins Invoker publisher to support the buildlog parameter.

          I see that this issue is closed but not released.

          I have 2 questions:
          1) Any idea when it could be released?
          2) Is the Jenkins Invoker Plugin used by the Jenkins Pipeline Maven plugin or are they separate and I should report the problem on the pipeline-maven-plugin component?

          Thanks!

          Vincent Massol added a comment - - edited Hi olamy ! We're hitting this issue on the XWiki project. We suddenly started seeing failed builds on ci.xwiki.org recently, even when everything was ok. After analyzing it we found that the Jenkins InvokerRun publisher now fails the build when there's an error: https://github.com/jenkinsci/pipeline-maven-plugin/commit/08f725b927d9ee934aeaea1f372e3562510d5a28#diff-07a0326a979930635b0f3f4bb291db752d478b8885ff7c76a5741ac866879804R146 Our error is: 289397 ERROR: [withMaven] invokerPublisher - exception archiving Invoker runs for Maven artifact MavenArtifact{org.xwiki.platform:xwiki-platform-tool-packager-plugin:maven-plugin:14.10.5-SNAPSHOT( version: 14.10.5-SNAPSHOT, snapshot:true) } generated by PluginInvocation{org.apache.maven.plugins:maven-invoker-plugin:3.3.0@run integration-test}: java.io.IOException: Unknown attribute 'buildlog' for tag 'build-job' (position: START_TAG seen ...m-tool-packager-plugin/target/it/basic-import-export/build.log" />... @2:263) . Failing the build. This looks like this issue and an error of the Jenkins Invoker publisher to support the buildlog parameter. I see that this issue is closed but not released. I have 2 questions: 1) Any idea when it could be released? 2) Is the Jenkins Invoker Plugin used by the Jenkins Pipeline Maven plugin or are they separate and I should report the problem on the pipeline-maven-plugin component? Thanks!

          Olivier Lamy added a comment -

          vmassol
          release 2.5 done.
          perso I do not use this plugin anymore but ask maven-invoker-plugin to generate surefire/junit result file (there is an option for that) and tell the jenkins junit plugin to parse those files as well as the standard test reports.

          Olivier Lamy added a comment - vmassol release 2.5 done. perso I do not use this plugin anymore but ask maven-invoker-plugin to generate surefire/junit result file (there is an option for that) and tell the jenkins junit plugin to parse those files as well as the standard test reports.

          Vincent Massol added a comment - - edited

          perso I do not use this plugin anymore but ask maven-invoker-plugin to generate surefire/junit result file (there is an option for that) and tell the jenkins junit plugin to parse those files as well as the standard test reports.

          olamy This is interesting, thanks! I found https://maven.apache.org/plugins/maven-invoker-plugin/run-mojo.html#writeJunitReport which is probably the config param you were referring to. However, how do you tell withMaven to also pick up the generated BUILD-*.xml files? I've not tried it yet but I see I can use <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> to generate the invoker test results in the same location as the surefire reports. Maybe that's enough for Jenkins to pick them up (if it's looking for all XML files rather than TEST-*.xml files).

          Vincent Massol added a comment - - edited perso I do not use this plugin anymore but ask maven-invoker-plugin to generate surefire/junit result file (there is an option for that) and tell the jenkins junit plugin to parse those files as well as the standard test reports. olamy This is interesting, thanks! I found https://maven.apache.org/plugins/maven-invoker-plugin/run-mojo.html#writeJunitReport which is probably the config param you were referring to. However, how do you tell withMaven to also pick up the generated BUILD-*.xml files? I've not tried it yet but I see I can use <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> to generate the invoker test results in the same location as the surefire reports. Maybe that's enough for Jenkins to pick them up (if it's looking for all XML files rather than TEST-*.xml files).

          Olivier Lamy added a comment -

          vmassol maybe keep using reports in */target/invoker-reports/TEST.xml. but yes not sure how to add this patttern to junit jenkins when using pipeline-maven-plugin though.

          so yes maybe changing to default surefire location will be easier.

          What I would recommend to use with m-invoker-p is to configure this as well <junitPackageName></junitPackageName>

          otherwise all results will under the same default package `maven.invoker.it`  can be a problem if your build have multiple maven plugins.

           

           

          Olivier Lamy added a comment - vmassol maybe keep using reports in * /target/invoker-reports/TEST .xml. but yes not sure how to add this patttern to junit jenkins when using pipeline-maven-plugin though. so yes maybe changing to default surefire location will be easier. What I would recommend to use with m-invoker-p is to configure this as well <junitPackageName></junitPackageName> otherwise all results will under the same default package `maven.invoker.it`  can be a problem if your build have multiple maven plugins.    

          Benoit added a comment - - edited

          Hello vmassol
          For withMaven, a fix is incoming, see https://issues.jenkins.io/browse/JENKINS-70561

          Benoit added a comment - - edited Hello vmassol For withMaven , a fix is incoming, see https://issues.jenkins.io/browse/JENKINS-70561

          bguerin ah, thanks! I now understand that the InvokerRun publisher used by the pipeline-maven-plugin is deprecated (the jenkinsci maven-invoker-plugin plugin being deprecated), and that we now need to stop using it and instead configure the maven invoker plugin to generate junit test results as we discussed above. Note that it's less seamless to use as before since it requires a specific config for the maven invoker plugin (unless you're planning to make that plugin generate junit test results by default in the future ).

          I'm going to eagerly wait for JENKINS-70561 now Thanks a lot for mentioning it.

          Vincent Massol added a comment - bguerin ah, thanks! I now understand that the InvokerRun publisher used by the pipeline-maven-plugin is deprecated (the jenkinsci maven-invoker-plugin plugin being deprecated), and that we now need to stop using it and instead configure the maven invoker plugin to generate junit test results as we discussed above. Note that it's less seamless to use as before since it requires a specific config for the maven invoker plugin (unless you're planning to make that plugin generate junit test results by default in the future ). I'm going to eagerly wait for JENKINS-70561 now Thanks a lot for mentioning it.

          Benoit added a comment - - edited

          the InvokerRun publisher used by the pipeline-maven-plugin is deprecated

          Hum ... no ...
          Because having maven-invoker-plugin generate JUnit like reports requires, as you say, a specific configuration, this publisher will still be needed
          But now, it will detect if you do not have such a configuration and warn you (in the build log) to enable it

          unless you're planning to make that plugin generate junit test results by default

          Sorry, but no. The pipeline-maven plugin can only react on what is being executed (and how) during the maven run, it cannot change the POM being executed

          I'm going to eagerly wait for JENKINS-70561 now

          Will be out by the end of the day

          Benoit added a comment - - edited the InvokerRun publisher used by the pipeline-maven-plugin is deprecated Hum ... no ... Because having maven-invoker-plugin generate JUnit like reports requires, as you say, a specific configuration, this publisher will still be needed But now, it will detect if you do not have such a configuration and warn you (in the build log) to enable it unless you're planning to make that plugin generate junit test results by default Sorry, but no. The pipeline-maven plugin can only react on what is being executed (and how) during the maven run, it cannot change the POM being executed I'm going to eagerly wait for JENKINS-70561 now Will be out by the end of the day

          Because having maven-invoker-plugin generate JUnit like reports requires, as you say, a specific configuration, this publisher will still be needed
          But now, it will detect if you do not have such a configuration and warn you (in the build log) to enable it

          ok I see.

          Will be out by the end of the day

          Great, thx!

          Vincent Massol added a comment - Because having maven-invoker-plugin generate JUnit like reports requires, as you say, a specific configuration, this publisher will still be needed But now, it will detect if you do not have such a configuration and warn you (in the build log) to enable it ok I see. Will be out by the end of the day Great, thx!

            olamy Olivier Lamy
            falcon benoit guerin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: