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

Impossible to import plugin classes in scripts since upgrade to Java 17

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • scriptler-plugin
    • None

      My team is running a Dockerized deployment of Jenkins. Recently, we have been trying to go from Jenkins version 2.462.2 to 2.489, and scriptler from version 376.v152edd95b_ca_f to 393.vc44e60d60fa_1.

      We have bunch of Scriptler scripts we use to sync configuration defined declaratively in our instance without restart. We used to be able to import classes from other installed plugins in the scripts, for example org.jenkins.plugins.lockableresources.LockableResource , CloudBees folder classes, etc.

      Now importing them results in compilation errors.

      Script1.groovy: 19: unable to resolve class org.jenkins.plugins.lockableresources.LockableResourcesManager @ line 19, column 1. import org.jenkins.plugins.lockableresources.LockableResourcesManager

      I have verified and running the same script from the script console works just fine. It also worked fine before the update. We use Scriptler mainly because we can run the scripts on the built-in node of the controller, since they modify internal Jenkins config, but we don't want regular jobs running there, so it's explicitly configured to have 0 executors. Is there something that changed recently in the way classes are loaded into the scripts that is preventing the plugins to be discoverable ?

        1. import-lockable-resources-manager.groovy
          0.2 kB
        2. getenv-PATH.groovy
          0.0 kB
        3. scriptler.xml
          0.9 kB
        4. scriptApproval.xml
          1 kB
        5. run-jenkins.sh
          0.9 kB
        6. plugins.txt
          2 kB

          [JENKINS-75019] Impossible to import plugin classes in scripts since upgrade to Java 17

          Charles created issue -
          Charles made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Charles made changes -
          Description Original: My team is running a Dockerized deployment of Jenkins. Recently, we have been trying to go from Jenkins version 2.462.2 to 2.489, and scriptler from version 376.v152edd95b_ca_f to 393.vc44e60d60fa_1.

          We have bunch of Scriptler scripts we use to sync configuration defined declaratively in our instance without restart. We used to be able to import classes from other installed plugins in the scripts, for example {{org.jenkins.plugins.lockableresources.LockableResource}} , CloudBees folder classes, etc.

          Now importing them results in compilation errors.

          {{{}Script1.groovy: 19: unable to resolve class org.jenkins.plugins.lockableresources.LockableResourcesManager @ line 19, column 1. import org.jenkins.plugins.lockableresources.LockableResourcesManager

          {}}}I have verified and running the same script from the script console works just fine. It also worked fine before the update. We use Scriptler mainly because we can run the scripts on the built-in node of the controller, since they modify internal Jenkins config, but we don't want regular jobs running there, so it's explicitly configured to have 0 executors. Is there something that changed recently in the way classes are loaded into the scripts that is preventing the plugins to be discoverable ? {{
          }}
          New: My team is running a Dockerized deployment of Jenkins. Recently, we have been trying to go from Jenkins version 2.462.2 to 2.489, and scriptler from version 376.v152edd95b_ca_f to 393.vc44e60d60fa_1.

          We have bunch of Scriptler scripts we use to sync configuration defined declaratively in our instance without restart. We used to be able to import classes from other installed plugins in the scripts, for example {{org.jenkins.plugins.lockableresources.LockableResource}} , CloudBees folder classes, etc.

          Now importing them results in compilation errors.

          {{Script1.groovy: 19: unable to resolve class org.jenkins.plugins.lockableresources.LockableResourcesManager @ line 19, column 1. import org.jenkins.plugins.lockableresources.LockableResourcesManager}}

          I have verified and running the same script from the script console works just fine. It also worked fine before the update. We use Scriptler mainly because we can run the scripts on the built-in node of the controller, since they modify internal Jenkins config, but we don't want regular jobs running there, so it's explicitly configured to have 0 executors. Is there something that changed recently in the way classes are loaded into the scripts that is preventing the plugins to be discoverable ?
          Mark Waite made changes -
          Attachment New: plugins.txt [ 63774 ]
          Mark Waite made changes -
          Attachment New: run-jenkins.sh [ 63775 ]
          Mark Waite made changes -
          Attachment New: scriptApproval.xml [ 63776 ]
          Mark Waite made changes -
          Attachment New: scriptler.xml [ 63777 ]
          Mark Waite made changes -
          Attachment New: getenv-PATH.groovy [ 63778 ]
          Mark Waite made changes -
          Attachment New: import-lockable-resources-manager.groovy [ 63779 ]
          Michael Tughan made changes -
          Released As New: https://github.com/jenkinsci/scriptler-plugin/releases/tag/397.vc46f19cb_3c18
          Assignee New: Michael Tughan [ mtughan ]
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            mtughan Michael Tughan
            ccoupaljette_goto Charles
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: