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

@NonCPS and @Library not visible in utility classes when used in pipeline model

XMLWordPrintable

      It seems that @NonCPS and @Library are not visible in the context of a pipeline model definition and must be fully qualified. ...but to be honest, I have no idea what FQN of this class is. In a "normal" pipeline script, this class is visible by default.

      the error I get is:

       > git config core.sparsecheckout # timeout=10
       > git checkout -f 925b9e05a9e0f6e9717275ad8215e9f07714f38b
       > git rev-list 925b9e05a9e0f6e9717275ad8215e9f07714f38b # timeout=10
      [Pipeline] End of Pipeline
      hudson.remoting.ProxyException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      file:/home/yooture/hudson_home/jobs/ci/jobs/dummy/builds/90/libs/yooture/src/yooture/jenkins/cloudfoundry/Cloudfoundry.groovy: 214: unable to resolve class NonCPS ,  unable to find class for annotation
       @ line 214, column 1.
         @NonCPS
         ^
      
      file:/home/yooture/hudson_home/jobs/ci/jobs/dummy/builds/90/libs/yooture/src/yooture/jenkins/cloudfoundry/Cloudfoundry.groovy: 220: unable to resolve class NonCPS ,  unable to find class for annotation
       @ line 220, column 1.
         @NonCPS
         ^
      
      2 errors
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:946)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)
      	at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Source)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter.compilationUnitToPipelineDef(Converter.groovy:136)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      

            abayer Andrew Bayer
            imod Dominik Bartholdi
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: