<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Jenkins &#8211; unable to resolve class utilities.MyUtilities	</title>
	<atom:link href="https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/feed/" rel="self" type="application/rss+xml" />
	<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/</link>
	<description>by Emil</description>
	<lastBuildDate>Thu, 28 May 2020 20:49:37 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.4</generator>
	<item>
		<title>
		By: Emil		</title>
		<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2018</link>

		<dc:creator><![CDATA[Emil]]></dc:creator>
		<pubDate>Thu, 28 May 2020 20:49:37 +0000</pubDate>
		<guid isPermaLink="false">https://emilwypych.com/?p=449#comment-2018</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2016&quot;&gt;birgerss&lt;/a&gt;.

You almost made it correct. :D 

First at all, you should not create a package from jobs. Only classes that will be used should be packaged. In jobs, you only import necessary classes. So you&#039;re job.groovy should look like this:

&lt;code&gt;import aws.Builder&lt;/code&gt;

Your Builder.groovy should have:

&lt;code&gt;package aws.Builder

class Builder {
...
}&lt;/code&gt;

Do you see the difference? In this example, I assume that jobDSL/builders is your additional classpath, that you have to add in the seed job configuration (this field will be available when script security is disabled). Packages names should contain ONLY the structure under the classpath and it would be great if they could have only one class with the same name as the package (see my code example with the class Builder).

jobDSL is just the directory of the whole project. Jobs directory contains only your jobs, and builders directory contains your helpers, builders, shared classes, or however you want to name those things. The thing is that all those paths have their own specialization and they are used according to Groovy syntax. During seed job configuration you should remember, that you need to configure it from the perspective of the root directory of the project. jobDSL as the directory should be committed (or classpath AND seed jobs paths should be extended, but it&#039;s quite... unclear). Let&#039;s assume that jobDSL is just the repository name with your stuff and it&#039;s being cloned during the seed job run. So that&#039;s your configuration:

DSL script: jobs/aws/job.groovy
Additional classpath (advanced settings): builders

Do you see how it works? With this, the job in jobs/aws/job.groovy will look for class aws.Builder, which is part of the aws.Builder package, that can be found in the builders classpath. If you want to change anything (like use jobDSL as the main directory and you want to get that directory in all the paths) just adjust this example. :D 

If anything is still unclear, don&#039;t hesitate to ask! :) And please remember about disabling the script security! Without that, you won&#039;t even see the additional classpath field in the seed job configuration!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2016">birgerss</a>.</p>
<p>You almost made it correct. 😀 </p>
<p>First at all, you should not create a package from jobs. Only classes that will be used should be packaged. In jobs, you only import necessary classes. So you&#8217;re job.groovy should look like this:</p>
<p><code>import aws.Builder</code></p>
<p>Your Builder.groovy should have:</p>
<p><code>package aws.Builder</p>
<p>class Builder {<br />
...<br />
}</code></p>
<p>Do you see the difference? In this example, I assume that jobDSL/builders is your additional classpath, that you have to add in the seed job configuration (this field will be available when script security is disabled). Packages names should contain ONLY the structure under the classpath and it would be great if they could have only one class with the same name as the package (see my code example with the class Builder).</p>
<p>jobDSL is just the directory of the whole project. Jobs directory contains only your jobs, and builders directory contains your helpers, builders, shared classes, or however you want to name those things. The thing is that all those paths have their own specialization and they are used according to Groovy syntax. During seed job configuration you should remember, that you need to configure it from the perspective of the root directory of the project. jobDSL as the directory should be committed (or classpath AND seed jobs paths should be extended, but it&#8217;s quite&#8230; unclear). Let&#8217;s assume that jobDSL is just the repository name with your stuff and it&#8217;s being cloned during the seed job run. So that&#8217;s your configuration:</p>
<p>DSL script: jobs/aws/job.groovy<br />
Additional classpath (advanced settings): builders</p>
<p>Do you see how it works? With this, the job in jobs/aws/job.groovy will look for class aws.Builder, which is part of the aws.Builder package, that can be found in the builders classpath. If you want to change anything (like use jobDSL as the main directory and you want to get that directory in all the paths) just adjust this example. 😀 </p>
<p>If anything is still unclear, don&#8217;t hesitate to ask! 🙂 And please remember about disabling the script security! Without that, you won&#8217;t even see the additional classpath field in the seed job configuration!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: birgerss		</title>
		<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2017</link>

		<dc:creator><![CDATA[birgerss]]></dc:creator>
		<pubDate>Thu, 28 May 2020 19:44:38 +0000</pubDate>
		<guid isPermaLink="false">https://emilwypych.com/?p=449#comment-2017</guid>

					<description><![CDATA[job.groovy is supposed to be:
package jobDSL.jobs.aws
import jobDSL.builders.aws.Builder]]></description>
			<content:encoded><![CDATA[<p>job.groovy is supposed to be:<br />
package jobDSL.jobs.aws<br />
import jobDSL.builders.aws.Builder</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: birgerss		</title>
		<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2016</link>

		<dc:creator><![CDATA[birgerss]]></dc:creator>
		<pubDate>Thu, 28 May 2020 19:41:36 +0000</pubDate>
		<guid isPermaLink="false">https://emilwypych.com/?p=449#comment-2016</guid>

					<description><![CDATA[Thanks for the response, still can&#039;t seem to get it fully working though. Might be that I&#039;m misunderstanding something.

This is my current file structure
jobDSL/
├── builders/aws
└─── Builder.groovy
└── jobs/aws
└─── job.groovy

Builder.groovy:
package jobDSL.builders.aws
...

job.groovy:
package jobDSL.jobs.aws
import jobDSL.builders.aws.DeployStackJobBuilder
...

And I have a seed job set up to run on the following files &quot;jobDSL/jobs/**/*.groovy&quot;

Still I get this error when running:
ERROR: startup failed:
job.groovy: 2: unable to resolve class jobDSL.builders.aws.Builder
 @ line 2, column 1.
   import jobDSL.builders.aws.Builder]]></description>
			<content:encoded><![CDATA[<p>Thanks for the response, still can&#8217;t seem to get it fully working though. Might be that I&#8217;m misunderstanding something.</p>
<p>This is my current file structure<br />
jobDSL/<br />
├── builders/aws<br />
└─── Builder.groovy<br />
└── jobs/aws<br />
└─── job.groovy</p>
<p>Builder.groovy:<br />
package jobDSL.builders.aws<br />
&#8230;</p>
<p>job.groovy:<br />
package jobDSL.jobs.aws<br />
import jobDSL.builders.aws.DeployStackJobBuilder<br />
&#8230;</p>
<p>And I have a seed job set up to run on the following files &#8220;jobDSL/jobs/**/*.groovy&#8221;</p>
<p>Still I get this error when running:<br />
ERROR: startup failed:<br />
job.groovy: 2: unable to resolve class jobDSL.builders.aws.Builder<br />
 @ line 2, column 1.<br />
   import jobDSL.builders.aws.Builder</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Emil		</title>
		<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2013</link>

		<dc:creator><![CDATA[Emil]]></dc:creator>
		<pubDate>Wed, 27 May 2020 14:25:13 +0000</pubDate>
		<guid isPermaLink="false">https://emilwypych.com/?p=449#comment-2013</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2012&quot;&gt;birgerss&lt;/a&gt;.

Of course, you can do that, but... you need to disable Script security in Security settings. If you do that, then &quot;Additional classpath&quot; will be available and you can type a classpath (in this scenario &quot;utilities&quot; directory). Unfortunately, I didn&#039;t find any other option without the necessity of choosing only some of the possible methods inside the sandbox.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2012">birgerss</a>.</p>
<p>Of course, you can do that, but&#8230; you need to disable Script security in Security settings. If you do that, then &#8220;Additional classpath&#8221; will be available and you can type a classpath (in this scenario &#8220;utilities&#8221; directory). Unfortunately, I didn&#8217;t find any other option without the necessity of choosing only some of the possible methods inside the sandbox.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: birgerss		</title>
		<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-2012</link>

		<dc:creator><![CDATA[birgerss]]></dc:creator>
		<pubDate>Wed, 27 May 2020 14:20:29 +0000</pubDate>
		<guid isPermaLink="false">https://emilwypych.com/?p=449#comment-2012</guid>

					<description><![CDATA[Is there really no way of creating the following folder structure:

```
dsl_scripts/
├── dsl
    └── mainDSL.groovy
└── utilities
    └── MyUtilities.groovy
```

When you have a large amount of jobs, not being able to sort them by folders quickly becomes a mess.]]></description>
			<content:encoded><![CDATA[<p>Is there really no way of creating the following folder structure:</p>
<p>&#8220;`<br />
dsl_scripts/<br />
├── dsl<br />
    └── mainDSL.groovy<br />
└── utilities<br />
    └── MyUtilities.groovy<br />
&#8220;`</p>
<p>When you have a large amount of jobs, not being able to sort them by folders quickly becomes a mess.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Emil		</title>
		<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-455</link>

		<dc:creator><![CDATA[Emil]]></dc:creator>
		<pubDate>Sat, 03 Nov 2018 12:47:29 +0000</pubDate>
		<guid isPermaLink="false">https://emilwypych.com/?p=449#comment-455</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-452&quot;&gt;gmo&lt;/a&gt;.

Thanks! :)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-452">gmo</a>.</p>
<p>Thanks! 🙂</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: gmo		</title>
		<link>https://emilwypych.com/2018/04/15/jenkins-unable-resolve-class-utilities-myutilities/#comment-452</link>

		<dc:creator><![CDATA[gmo]]></dc:creator>
		<pubDate>Thu, 01 Nov 2018 01:23:13 +0000</pubDate>
		<guid isPermaLink="false">https://emilwypych.com/?p=449#comment-452</guid>

					<description><![CDATA[+1 on making a detail tutorial]]></description>
			<content:encoded><![CDATA[<p>+1 on making a detail tutorial</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Object Caching 30/56 objects using Disk
Page Caching using Disk: Enhanced 
Minified using Disk

Served from: emilwypych.com @ 2025-12-01 05:08:29 by W3 Total Cache
-->