Maybe you need a "return this" at the end of the groovy file (as in
https://github.com/docker/jenkins-pipeline-scripts/blob/master/src/com/docker/utilities/AWSSync.groovy
)?

On Fri, Aug 25, 2017 at 9:08 AM red 888 <[email protected]> wrote:

> Im trying to wrap my head around shared libraries (with descriptive not
> scripted pipelines) and I'm not sure how I should be doing this.
>
> Right now I have this in my jenkinsfile:
>
> def Storeinvar = powershell (
>     script: '$PSVersionTable.PSVersion.major',
>     returnStdout: true)
>
> So I'm shelling out, running some command, and storing the result of that
> command in a var.
>
> I want to put that in a shared library and call it anywhere in my
> jenkinsfile.
>
> I created a file in my library: /var/myTest.groovy I put this in it to
> test:
>
> def methA(body) {
>      return 'FROM LIBRARY'}def methB(body) {
>      return 'FROM LIBRARY'}
>
> In my jenkinsfile i call them like this:
>
> echo gitInfo.methA()
> echo gitInfo.methB()
>
> But i get this error:
>
> groovy.lang.MissingPropertyException: No such property: myTest for class: 
> groovy.lang.Binding
>
>
> --
> 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/cbd9d243-ee34-4cd4-89b8-8def41fdfa77%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/cbd9d243-ee34-4cd4-89b8-8def41fdfa77%40googlegroups.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/CAO49JtG_329tP-5RKRrUFgiURxWRRc4%2BzWvnZUnB_hm_R-Svuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to