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

InjectedTest fails on shaded jar

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Won't Do
    • Component/s: jenkins-test-harness
    • Labels:
      None
    • Environment:
      Ubuntu 20.04, Github actions
    • Similar Issues:

      Description

      When I'm testing my plugin peass-ci (https://github.com/DaGeRe/peass-ci/), which uses the tool peass (https://github.com/DaGeRe/peass/), an error occurs in the InjectedTest.

      Everytime the test is executed using

      mvn clean test

      the builds failed with 

      Caused by: java.io.IOException: Failed to load: Peass-CI Plugin (0.1-SNAPSHOT (private-3cc0b539-runner)) - Plugin is missing: structs (1.20) at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:952) at hudson.PluginManager$2$1$1.run(PluginManager.java:549) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1131) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more

       

      (See ++https://github.com/DaGeRe/peass-ci/runs/1844767341?check_suite_focus=true )

      After digging deeper into this, the error eems to be caused by missing org.apache.tools.ant.types.ResourceCollection.stream()Ljava/util/stream

      from and 1.10.9 (which is present in target/jenkins-for-test) and output like this is created:

       

      WARNING: Inspecting plugin /home/reichelt/nvme/workspaces/dissworkspace/permanent/peass-ci/target/tmp/jenkins1381396924049149488/plugins/apache-httpcomponents-client-4-api.jpi failed perhaps due to plugin dependency issues
      java.lang.NoSuchMethodError: org.apache.tools.ant.types.ResourceCollection.stream()Ljava/util/stream/Stream;
       at org.apache.tools.ant.types.resources.MappedResourceCollection.getCollection(MappedResourceCollection.java:245)
       at org.apache.tools.ant.types.resources.MappedResourceCollection.cacheCollection(MappedResourceCollection.java:228)
       at org.apache.tools.ant.types.resources.MappedResourceCollection.iterator(MappedResourceCollection.java:157)
       at org.apache.tools.ant.taskdefs.Zip.grabNonFileSetResources(Zip.java:1308)
       at org.apache.tools.ant.taskdefs.Zip.getNonFileSetResourcesToAdd(Zip.java:1191)
       at org.apache.tools.ant.taskdefs.Zip.getResourcesToAdd(Zip.java:968)
       at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:490)
       at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:410)
       at hudson.ClassicPluginStrategy.createClassJarFromWebInfClasses(ClassicPluginStrategy.java:542)
       at hudson.ClassicPluginStrategy.explode(ClassicPluginStrategy.java:484)
       at hudson.ClassicPluginStrategy.createPluginWrapper(ClassicPluginStrategy.java:175)
       at hudson.PluginManager$1$3$1.run(PluginManager.java:436)
       at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
       at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
       at jenkins.model.Jenkins$5.runTask(Jenkins.java:1131)
       at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
       at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
       at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
       at java.lang.Thread.run(Thread.java:748)

       

      This error seems to be caused by depending on a tool which creates a shaded jar.

      In my case, since de.peass.peass-distribution is just a distribution jar which should ease the access to the main method, using the non-shaded library de.peass.analysis (https://github.com/DaGeRe/peass-ci/commit/b8ed5a409e3e478da358bffebeced339524035aa) fixes the problem. It is also sufficient to remove the call to the shade-plugin to get rid of the error. On the other hand, it is not sufficient to just remove the multi-release-jar flag.

        Attachments

          Activity

          Hide
          jglick Jesse Glick added a comment -

          For various reasons, using the Shade plugin does not work on a single-module reactor. You will need to shade your library in one dedicated submodule, then depend on that in another module for the Jenkins plugin.

          Show
          jglick Jesse Glick added a comment - For various reasons, using the Shade plugin does not work on a single-module reactor. You will need to shade your library in one dedicated submodule, then depend on that in another module for the Jenkins plugin.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dagere David Georg Reichelt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: