This was a new pipeline. I changed how the library was specified, using the library { lib } structure and that worked.
On Monday, 17 August 2020 17:26:48 UTC-4, Devin Nusbaum wrote: > > This sounds like JENKINS-60245 > <https://issues.jenkins-ci.org/browse/JENKINS-60245>. There is a proposed > fix, but I have not had time to review it. > > Is this something you had working previously, and it was broken by an > update or something, or are you just trying it for the first time? > > You might be able to use the `library` step instead of the `@Library` > annotation as a workaround for now. > > > On Aug 17, 2020, at 17:01, Randall Becker <the....@gmail.com <javascript:>> > wrote: > > I'm having some difficulty with global shared groovy libraries in > pipelines (Jenkins 2.242, with Pipeline:Groovy Shared Libraries 2.16) and > could use a swift kick in the proper direction. > > I've configured a local bare git repository using it's path in the System > Configuration, which correctly reports the commit associated with the HEAD > of master. Since this is local, there are no credentials involved. > > The groovy script is loaded in my pipeline (not a Jenkinsfile, just a > simple project), as follows - from a file outside the workspace, which is > not yet populated at the load step: > > stage('load') { > steps { > script { > modules.first = load > pwd()+'/../../OtherJob/workspace/publisher.groovy' > } > } > } > > The load works and I can execute simple things, but when trying to > reference the library I get the error that > ERROR: Could not find any definition of libraries [mylib], > > The first line of the publisher.groovy script is: > @Library('mylib') _ > > And the exception thrown is below (there is more, obviously). Nothing in > the jenkins log, this is from the build console > > org.jenkinsci.plugins.workflow.cps.CpsCompilationErrorsException: startup > failed: > Script1.groovy: Loading libraries failed > > 1 error > > at > org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) > at > org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085) > at > org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603) > at > org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558) > at > groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) > at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) > at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) > at groovy.lang.GroovyShell.parse(GroovyShell.java:700) > ... > > I really want to share code (not variables) as I have about 30 pipelines > that need my groovy classes. Obviously I'm doing something wrong, but the > diagnostics are not providing a nice hint to help me out with resolving > this. Any suggestions? > > Thanks in advance, > Randall > > > > -- > 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 jenkins...@googlegroups.com <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/f5350044-b8b1-4e3e-b613-36bb9eade86ao%40googlegroups.com > > <https://groups.google.com/d/msgid/jenkinsci-users/f5350044-b8b1-4e3e-b613-36bb9eade86ao%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- 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 jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2a941b57-aafa-4443-98a8-189f048d8738o%40googlegroups.com.