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

SloccountPublisher fails on Java 11 without --add-modules java.xml.bind

    XMLWordPrintable

Details

    • JAXB Plugin

    Description

      Using a Jenkins running on Java 11 (Java 11 support is currently in preview (https://jenkins.io/blog/2018/12/14/java11-preview-availability/), SloccountPublisher throws the following exception while generating the report.

      janv. 16, 2019 2:26:14 PM hudson.model.AbstractBuild$AbstractBuildExecution reportError
      WARNING: Step ‘Publish SLOCCount analysis results’ aborted due to exception: 
      java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
              at hudson.plugins.sloccount.SloccountPublisher.perform(SloccountPublisher.java:82)
              at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
              at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
              at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
              at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
              at hudson.model.Build$BuildExecution.post2(Build.java:186)
              at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
              at hudson.model.Run.execute(Run.java:1835)
              at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
              at hudson.model.ResourceController.execute(ResourceController.java:97)
              at hudson.model.Executor.run(Executor.java:429)
      Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
              at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1374)
              at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1327)
              at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1080)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
              ... 11 more
      

      Expected behavior

      Though there is ongoing work to see how/if to keep making JAXB usages in Jenkins on Java 11+, it would be nice if the plugin code could be analyzed to see if it could work without depending on JAXB API (which has been removed from the JDK starting from Java 9+).

      Technical consideration

      Looking at the code quickly, I think the main (only?) reason JAXB usage is to marshall/unmarshall the ClocReport.

      I think replacing the serialization with an XStream marshalling would probably achieve the same thing, while removing the JAXB dependency.

      Attachments

        Issue Links

          Activity

            People

              npiguet npiguet
              batmat Baptiste Mathus
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: