Pipeline Global Library vars file naming convention

72 views
Skip to first unread message

Sverre Moe

unread,
May 31, 2016, 6:01:23 AM5/31/16
to Jenkins Users
This naming does not work:
vars/packageInformation.groovy

I get the following exception when calling a function packageInformation.init()
java.lang.NullPointerException: Cannot invoke method init() on null object

This works
vars/packageinformation.groovy

According to the instructions/tutorial on GitHub the files should be camelCased.
The vars directory hosts scripts that define global variables accessible from Pipeline scripts. The basename of each*.groovy file should be a Groovy (~ Java) identifier, conventionally camelCased.


Daniel Beck

unread,
May 31, 2016, 6:55:59 AM5/31/16
to jenkins...@googlegroups.com

> On 31.05.2016, at 12:01, Sverre Moe <sverr...@gmail.com> wrote:
>
> This naming does not work:
> vars/packageInformation.groovy
>
> I get the following exception when calling a function packageInformation.init()
> java.lang.NullPointerException: Cannot invoke method init() on null object
>
> This works
> vars/packageinformation.groovy
>

Bug reports should go into JIRA:
https://wiki.jenkins-ci.org/display/JENKINS/How+to+report+an+issue

Sverre Moe

unread,
May 31, 2016, 7:38:08 AM5/31/16
to Jenkins Users, m...@beckweb.net
Well if it is a bug. I was not entirely sure as I have just begun using Pipeline.
I will create a bug report of this problem.

ludovic SMADJA

unread,
Jun 1, 2016, 5:47:32 AM6/1/16
to jenkins...@googlegroups.com
On our environment, the vars is camelCase without any problems. But we are using is as block :

for example :

JaliosPlugin{
mailrecipients : ludovic...@jalios.com
}

Others elements are designed as classes and in our case are used with new operator , like :

new com.jalios.build.MailNotifier().send(config.mailRecipients)

Perhaps to use a function, you need to have class which can be instanciated and vars in only pipeline steps ?
--


Ludovic SMADJA
R&D engineer - build process and development
JALIOS SA
http://www.jalios.com

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/15440b57-4f2f-4594-99a1-c06a765ab36d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages