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

Remove org.jenkins-ci.plugins:junit dependency

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • logstash-plugin
    • None

      Hi this is regarding logstash-plugin specifically: logstash-plugin/pom.xml at master · jenkinsci/logstash-plugin (github.com)
       
      org.jenkins-ci.plugins:junit was added as part of this commit: Respect Mask Password plugin configuration · jenkinsci/logstash-plugin@31e8971 (github.com)
       
      But then mask-passwords is no longer used now: remove dependency to maskpasswords by mwinter69 · Pull Request #48 · jenkinsci/logstash-plugin (github.com).
       
      So this begs the question if org.jenkins-ci.plugins:junit serves any purpose? Should this be removed instead?
       
      I tried running mvn test locally without it, seems to work fine.
       
      Removing it will make logstash plugin more lightweight: as junit plugin requires the following dependencies as listed on this web page: [JUnit | Jenkins plugin|https://plugins.jenkins.io/junit/dependencies/]:

      Dependencies

      Bootstrap 5 API ≥ 5.3.2-3
      Checks API ≥ 2.0.2
      ECharts API ≥ 5.4.0-7
      Ionicons API ≥ 70.v2959a_b_74e3cf
      Plugin Utilities API ≥ 3.8.0
      Pipeline: API ≥ 1291.v51fd2a_625da_7
      Pipeline: Step API ≥ 657.v03b_e8115821b_
      Display URL API ≥ 2.200.vb_9327d658781
      Jackson 2 API ≥ 2.17.0-379.v02de8ec9f64c
      Script Security ≥ 1335.vf07d9ce377a_e
       
       

          [JENKINS-73724] Remove org.jenkins-ci.plugins:junit dependency

          Jakub Bochenski added a comment - - edited

          This happened some time ago, so I don't recall much.

          Anyhow it seems we should not depend on jenkins junit in production code at least

          Jakub Bochenski added a comment - - edited This happened some time ago, so I don't recall much. Anyhow it seems we should not depend on jenkins junit in production code at least

          Wei Yuan Cho added a comment -

          It seems that this Jira JENKINS-25673 Add test results to the output - Jenkins Jira made this plugin require JUnit.

          Specifically the BuildData class:

          logstash-plugin/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java at master · jenkinsci/logstash-plugin (github.com)

          As it imports the following that requires it

          import hudson.tasks.test.AbstractTestResultAction;
          import hudson.tasks.test.TestResult;

          I assumed it would be a straightforward change and that no classes would require JUnit in production. However, it seems that is not the situation. Unfortunately, I'm not sufficiently familiar with this plugin to assist further in its implementation.

          Wei Yuan Cho added a comment - It seems that this Jira JENKINS-25673 Add test results to the output - Jenkins Jira made this plugin require JUnit. Specifically the BuildData class: logstash-plugin/src/main/java/jenkins/plugins/logstash/persistence/BuildData.java at master · jenkinsci/logstash-plugin (github.com) As it imports the following that requires it import hudson.tasks.test.AbstractTestResultAction; import hudson.tasks.test.TestResult; I assumed it would be a straightforward change and that no classes would require JUnit in production. However, it seems that is not the situation. Unfortunately, I'm not sufficiently familiar with this plugin to assist further in its implementation.

          Oh, sorry I think I misunderstood you.

          I thought we were including Jenkins test harness etc in the production output.

          If it's just the Jenkins plugin that handles JUnit reports that is fine. I think it's required if we want to include the test results in the payload sent by the plugin

          Jakub Bochenski added a comment - Oh, sorry I think I misunderstood you. I thought we were including Jenkins test harness etc in the production output. If it's just the Jenkins plugin that handles JUnit reports that is fine. I think it's required if we want to include the test results in the payload sent by the plugin

          Wei Yuan Cho added a comment -

           

              <dependency>
                <groupId>org.jenkins-ci.plugins</groupId>
                <artifactId>junit</artifactId>
              </dependency> 

          It's the above dependency which I initially propose to remove, but is needed to handle JUnit report. 

           

          In that case, please close the JIRA. it was just my lack of understanding

          Wei Yuan Cho added a comment -     <dependency>       <groupId>org.jenkins-ci.plugins</groupId>       <artifactId>junit</artifactId>     </dependency> It's the above dependency which I initially propose to remove, but is needed to handle JUnit report.    In that case, please close the JIRA. it was just my lack of understanding

            jbochenski Jakub Bochenski
            choweiyuan Wei Yuan Cho
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: