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

classes from "junit" Jenkins plugin are not available in class path in IDEA

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • gradle-jpi-plugin
    • None

      I have a Gradle-based Jenkins plugin.
      I'm trying to collect test results from a Jenkins build similarly how it is done in "logstash" plugin (which is Maven-based):
      https://github.com/jenkinsci/logstash-plugin

      I need to access hundson.tasks.test.AbstractTestResultAction class, which is now moved from Jenkins Core to Jenkins Junit plugin.

      the problem is that if I declare the dependency as

              jenkinsPlugins 'org.jenkins-ci.plugins:junit:1.6@jar'
      

      , then my Gradle command-line build ("gradle jpi") works fine, but this class (and all classes from that library are not available in Jetbrains IDEA).
      and if I declare it as

              jenkinsPlugins 'org.jenkins-ci.plugins:junit:1.6'
      

      , then it becomes visible in IDEA, but command-line build starts to fail:

      /.../src/main/java/org/jenkinsci/plugins/jpp/BuildMessageBuilder.java:9: error: package hudson.tasks.test does not exist
      import hudson.tasks.test.AbstractTestResultAction;
      ^
      1 error

      it may be a bug in IDEA rather than jpi plugin, of course. but maybe there is something that can be done in the plugin to simplify IDEA's dependency resolution?..

          [JENKINS-29327] classes from "junit" Jenkins plugin are not available in class path in IDEA

          I think it's a bug in IDEA. I had similar problems with the Job DSL plugin. The workaround is to hit the "Refresh all Gradle projects" button a few times until the plugin JAR appears in "External Libraries".

          Daniel Spilker added a comment - I think it's a bug in IDEA. I had similar problems with the Job DSL plugin. The workaround is to hit the "Refresh all Gradle projects" button a few times until the plugin JAR appears in "External Libraries".

          Alex Java added a comment -

          I removed the "@jar" type from artifact, refreshed the project in IDEA - the compilation error was gone. then put "@jar" back again and this time everything was fine in both IDEA and command-line build. if there is nothing to improve in the plugin, then I can report this bug to IDEA devs.

          Alex Java added a comment - I removed the "@jar" type from artifact, refreshed the project in IDEA - the compilation error was gone. then put "@jar" back again and this time everything was fine in both IDEA and command-line build. if there is nothing to improve in the plugin, then I can report this bug to IDEA devs.

          Alex Java added a comment -

          Alex Java added a comment - submitted: https://youtrack.jetbrains.com/issue/IDEA-142527

          Alex Java added a comment -

          IDEA guys fixed this bug in IDEA 15. yay!

          Alex Java added a comment - IDEA guys fixed this bug in IDEA 15. yay!

            daspilker Daniel Spilker
            alskor Alex Java
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: