Yep,
My libraries are already configured there, but the DSL script is obviously 
not working. Perhaps the syntax needs to be different...

On Sunday, August 26, 2018 at 6:04:36 PM UTC+3, Jan Monterrubio wrote:
>
> Manage Jenkins -> configure system -> global libraries 
>
> You can add your shared library there. 
>
> On Fri, Aug 17, 2018 at 11:05 <[email protected] <javascript:>> wrote:
>
>> Hey,
>>
>> I am looking for advice how to achieve usage of Jenkins shared library in 
>> Job DSL – 
>> I use this snipped to seed a job whose functionality is in Jenkins file:
>>
>>
>> job('my-small-test-job') {
>> parameters {
>> stringParam('branch', '${branch}')
>> } 
>> removedJobAction: 'IGNORE'
>> def releaseScript = readFileFromWorkspace('Jenkinsfile')
>> steps {
>>       dsl {
>>       text(releaseScript)
>>       }
>> }
>> }
>>
>> The newly created [my-small-test-job] has this content (taken out of the 
>> Jenkinsfile): 
>>
>> @Library('templates')_
>>
>> stage('Demo') {
>>     echo 'Hello world'
>>     jobBuilder {
>>       nodeLabels = 'linux && test'
>>       antExtraArgs = 'test 
>> -Dtest.suite=com.softwareag.suites.custom.ToolsTestSuite'
>> }
>> }
>>
>> I have a shared library under [templates] that is a generic job builder 
>> (the syntax is typical groovy like jenkins pipeline, similar to what is 
>> explained here: https://jenkins.io/doc/book/pipeline/shared-libraries/)
>>
>>
>> When I try to run the newly created [my-small-test-job] I get this: 
>>
>> Processing provided DSL script
>> ERROR: startup failed:
>> script: 1: unable to resolve class Library ,  unable to find class for 
>> annotation
>>  @ line 1, column 1.
>>    @Library('templates')_
>>    ^
>>
>> 1 error
>>
>>
>> The shared library is obviusly not added to classpath. How do I fix this?
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/6e3b23aa-873b-40c6-9859-c5cd7356611f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/6e3b23aa-873b-40c6-9859-c5cd7356611f%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/c73bac9e-3df4-4f83-a3c1-fb994c8cc13d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to