How to Import a java jar on jenkins to be used by Job DSL - Groovy Script ?

2020-12-14 Thread Charles Moulliard
Hi, How can we Import a java jar on jenkins in order to allow a Groovy Script part of a Job DSL to use java classes packaged within the jar file ? Example of groovy script using the Java class Hello and method "message" package groovy import dev.snowdrop.jenkins.Hello; println new Hello().mess

Re: How to Import a java jar on jenkins to be used by Job DSL - Groovy Script ?

2020-12-14 Thread Nick Stolwijk
Hi Charles, I think you can do this using the third party library @Grab [1]. I have taken a look in the documentation of Grape [2] and I see they use a custom Maven repository to load the libraries. [1] https://www.jenkins.io/doc/book/pipeline/shared-libraries/#using-third-party-libraries [2] htt

Re: How to Import a java jar on jenkins to be used by Job DSL - Groovy Script ?

2020-12-14 Thread Yeikel
How about shared libraries? https://www.jenkins.io/doc/book/pipeline/shared-libraries/ On Mon, Dec 14, 2020 at 10:55 AM Charles Moulliard wrote: > Hi, > > How can we Import a java jar on jenkins in order to allow a Groovy Script > part of a Job DSL to use java classes packaged within the jar fi

Re: How to Import a java jar on jenkins to be used by Job DSL - Groovy Script ?

2020-12-14 Thread Nick Stolwijk
Sorry, missed the part about JobDSL. I found a plugin which makes that possible: https://github.com/AOEpeople/gradle-jenkins-job-dsl-plugin With regards, Nick Stolwijk ~~~ Try to leave this world a little better than you found it and, when your turn comes to die, you can die happy in feeling tha

Re: How to Import a java jar on jenkins to be used by Job DSL - Groovy Script ?

2020-12-14 Thread Yeikel
As per the documentation @grap is an option but it is not recommended. You should either create a shared library or call `sh java jar...` and it all depends on what you need. On Mon, Dec 14, 2020 at 11:12 AM Yeikel wrote: > How about shared libraries? > > https://www.jenkins.io/doc/book/pipelin

Re: How to Import a java jar on jenkins to be used by Job DSL - Groovy Script ?

2020-12-14 Thread Charles Moulliard
The approach you propose is only supported if you create Pipeline Jobs. On Monday, December 14, 2020 at 5:12:04 PM UTC+1 Nick Stolwijk wrote: > Hi Charles, > > I think you can do this using the third party library @Grab [1]. I have > taken a look in the documentation of Grape [2] and I see they

Re: How to Import a java jar on jenkins to be used by Job DSL - Groovy Script ?

2020-12-14 Thread Charles Moulliard
Same remark as before. The approach you propose is only supported if you create Pipeline Jobs. On Monday, December 14, 2020 at 5:13:17 PM UTC+1 yeik...@gmail.com wrote: > How about shared libraries? > > https://www.jenkins.io/doc/book/pipeline/shared-libraries/ > > On Mon, Dec 14, 2020 at 10:55

BUG with libraryResource : No such library resource null could be found.

2020-12-14 Thread Yannick Lacaute
Hi, In a shared library, in a groovy script in /vars, the following code is working perfectly: String call(String stageName) { String cowMsg = libraryResource 'cow.txt' if (cowMsg != null) { def vars = [:] vars['MESSAGE'] = "BEGIN STAGE: ${stageName}" def engine = new StreamingTe

Jenkinsfile: Build job does not pass parameters

2020-12-14 Thread Adrian Wyssmann
I have a shared library which reads parameters from the jenkinsfile so here is the important snippet of the shared library ( *defaultCiPipelineGeneric.groovy*) def call(body) { // evaluate the body block, and collect configuration into the object def pipelineParams= [:] body.resolveStr

Need to set condition as build failed then build should be seen as failure

2020-12-14 Thread sanjay naik
HI All, I am using MSBILD plugins for compiling C# code in jenkins & using solution file I am compiling C# code, but if I run multiple solution file in 1 job & in case 1 solution file getting error and all are successful then build showing successful instead of failure. I am attaching screensho