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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

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().message();

Cheers 

Charles

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

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

Nick_S
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.


Hth,

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 that at any rate you have not wasted your time but have done your best ~~~

Lord Baden-Powell


On Mon, Dec 14, 2020 at 4:55 PM Charles Moulliard <[hidden email]> 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 file ?

Example of groovy script using the Java class Hello and method "message" 

package groovy
import dev.snowdrop.jenkins.Hello;
println new Hello().message();

Cheers 

Charles

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAA9S6i65jEc_vvDMovZqbCjX2L1W3WE2TABNJ295EZXPzS4jYg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

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

Yeikel Santana
In reply to this post by Charles Moulliard

On Mon, Dec 14, 2020 at 10:55 AM Charles Moulliard <[hidden email]> 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 file ?

Example of groovy script using the Java class Hello and method "message" 

package groovy
import dev.snowdrop.jenkins.Hello;
println new Hello().message();

Cheers 

Charles

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMMhyA3fPuwCxwsaOMb7NWj2zs1jSYFzVGOz8%3DUC2ZLX0pgE6w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

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

Nick_S
In reply to this post by Nick_S
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 that at any rate you have not wasted your time but have done your best ~~~

Lord Baden-Powell


On Mon, Dec 14, 2020 at 5:11 PM Nick Stolwijk <[hidden email]> 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 use a custom Maven repository to load the libraries.


Hth,

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 that at any rate you have not wasted your time but have done your best ~~~

Lord Baden-Powell


On Mon, Dec 14, 2020 at 4:55 PM Charles Moulliard <[hidden email]> 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 file ?

Example of groovy script using the Java class Hello and method "message" 

package groovy
import dev.snowdrop.jenkins.Hello;
println new Hello().message();

Cheers 

Charles

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAA9S6i5OfPqyfx3z%3Dqetg1640GNXGchizjr_E%2BS9q4tF0%2BQo%2Bg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

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

Yeikel Santana
In reply to this post by Yeikel Santana
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 <[hidden email]> wrote:

On Mon, Dec 14, 2020 at 10:55 AM Charles Moulliard <[hidden email]> 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 file ?

Example of groovy script using the Java class Hello and method "message" 

package groovy
import dev.snowdrop.jenkins.Hello;
println new Hello().message();

Cheers 

Charles

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMMhyA2sskHbrH7ANQijNLVXLkAF0G0-8ccgEqCE-cqV%2Bt7GvQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

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

Charles Moulliard
In reply to this post by Nick_S
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 use a custom Maven repository to load the libraries.


Hth,

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 that at any rate you have not wasted your time but have done your best ~~~

Lord Baden-Powell


On Mon, Dec 14, 2020 at 4:55 PM Charles Moulliard <[hidden email]> 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 file ?

Example of groovy script using the Java class Hello and method "message" 

package groovy
import dev.snowdrop.jenkins.Hello;
println new Hello().message();

Cheers 

Charles

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b5945d8f-1c6a-44a3-8df5-785cc22a0666n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

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

Charles Moulliard
In reply to this post by Yeikel Santana
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 [hidden email] wrote:

On Mon, Dec 14, 2020 at 10:55 AM Charles Moulliard <[hidden email]> 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 file ?

Example of groovy script using the Java class Hello and method "message" 

package groovy
import dev.snowdrop.jenkins.Hello;
println new Hello().message();

Cheers 

Charles

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28daa31-1da7-423c-ab7c-f14820f985ecn%40googlegroups.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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d28ed4b5-fc66-4b68-9564-3e94a886807bn%40googlegroups.com.