Many thanks Ivan for the example which is a Groovy class and not a java
class. According to the documentation, I don't think that we can use some
java classes directly from a shared lib project excepted if thy have been
compiled, packaged as jar under a maven repository and that you import it
using "@Grab" -
https://www.jenkins.io/doc/book/pipeline/shared-libraries/#using-third-party-libraries



On Thu, Jan 7, 2021 at 6:02 PM Ivan Fernandez Calvo <kuisathave...@gmail.com>
wrote:

> you can use directly a class from the Shared library
>
> This is an example in our shared library (
> https://github.com/elastic/apm-pipeline-library)
>
> https://github.com/elastic/apm-pipeline-library/blob/master/src/co/elastic/matrix/DefaultParallelTaskGenerator.groovy
>
> and a pipeline that uses that class
>
> https://github.com/elastic/apm-integration-testing/blob/master/.ci/integrationTestDownstream.groovy#L89
>
> El miércoles, 6 de enero de 2021 a las 18:23:12 UTC+1, cmou...@redhat.com
> escribió:
>
>> Hi,
>>
>> Can we define a pipeline DSL script importing a shared lib which is a
>> java class ?
>>
>> Script
>> @org.jenkinsci.plugins.workflow.libs.Library('mytools')
>>
>> import org.mytools.Messaging // The Java class imported as shared lib
>> Messaging m = new Messaging();
>>
>> The java class has been defined under the folder
>> `src/main/org/mytools/Messaging.java` within the git project cloned as
>> shared lib
>>
>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/1216e835-5752-482f-b887-565bc4cc7194n%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/1216e835-5752-482f-b887-565bc4cc7194n%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/CAPb1sSt7t%2BSpafDcCW_dEykio6t316i-TTpJxwLPRD_xX1kTyQ%40mail.gmail.com.

Reply via email to