Are you missing the @Library import in your pipeline? Or does your shared library have a load implicitly declared?
https://jenkins.io/doc/book/pipeline/shared-libraries/ On Tue, Oct 16, 2018 at 14:49 Peter Berghold <[email protected]> wrote: > Here is a tree of a very simple "library" I set up: > > ├── build.xml > ├── manifest.mf > ├── nbproject > │ ├── build-impl.xml > │ ├── genfiles.properties > │ ├── groovy-build.xml > │ ├── private > │ │ ├── config.properties > │ │ ├── private.properties > │ │ └── private.xml > │ ├── project.properties > │ └── project.xml > └── src > ├── net > │ └── berghold > │ └── MainTest.groovy > └── SimpleGroovyScript.groovy > > > Most important of which is under "src" with the class MainTest > > Here is the class itself: > > /* > * To change this license header, choose License Headers in Project > Properties. > * To change this template file, choose Tools | Templates > * and open the template in the editor. > */ > > package net.berghold > > /** > * > * @author peter > */ > class MainTest implements Serializable { > def Object context > > def void runme(){ > context.sh('echo foobar') > } > } > > so far nothing earth shattering. I've set up this shared library in the > main Jenkins setup menu. Should be groovy so far but it isn't > > Here is a simple pipeline I set up to test this: > > import net.berghold.MainTest > > node('master'){ > step('run test'){ > def MainTest mt = new MainTest(context: this) > > mt.runme() > } > } > > When I try to "build" this I get the following error to the console: > > Running in Durability level: MAX_SURVIVABILITY > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > WorkflowScript: 1: unable to resolve class net.berghold.MainTest > @ line 1, column 1. > import net.berghold.MainTest > ^ > > 1 error > > > to me that implies the library is not being loaded for reasons I just > don't get. > > Things I tried: > > I actually told it to implicitly load this library but it now complains > that it needs a version. I told it "master" and it claims it can't find > that version. I tried */master refs/master and a few other things I know > exist and the error came back that it could not validate the version with a > null pointer error under the details. > > Has this functionality been broken? > > Running Jenkins 2.147. This all used to work. This example is a pared > down version and the original shared libs that worked no longer work and > I'm a bit concerned. > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/CAArvnv3tBnk9B3Xm4Z2vug%2BNCv92822k5H70xRm_%3D-DW7jdhKg%40mail.gmail.com > <https://groups.google.com/d/msgid/jenkinsci-users/CAArvnv3tBnk9B3Xm4Z2vug%2BNCv92822k5H70xRm_%3D-DW7jdhKg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9KYK0pAY5bvo%2BdXEVW8mAZ2nx%3DNGOhyggwKdm1ajGXp5w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
