<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jenkins &#8211; My Shitty Code</title>
	<atom:link href="https://myshittycode.com/tag/jenkins/feed/" rel="self" type="application/rss+xml" />
	<link>https://myshittycode.com</link>
	<description>Embracing the Messiness in Search of Epic Solutions</description>
	<lastBuildDate>Fri, 06 Jan 2023 17:02:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://myshittycode.com/wp-content/uploads/2022/04/cropped-icon-32x32.png</url>
	<title>Jenkins &#8211; My Shitty Code</title>
	<link>https://myshittycode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">205304208</site>	<item>
		<title>Jenkins: Getting Karma Generated Test Results to Appear in Maven Project Job</title>
		<link>https://myshittycode.com/2014/11/11/jenkins-getting-karma-generated-test-results-to-appear-in-maven-project-job/</link>
					<comments>https://myshittycode.com/2014/11/11/jenkins-getting-karma-generated-test-results-to-appear-in-maven-project-job/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Tue, 11 Nov 2014 14:00:42 +0000</pubDate>
				<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Jenkins]]></category>
		<category><![CDATA[Karma]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Karma Plugin]]></category>
		<category><![CDATA[NodeJS]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=597</guid>

					<description><![CDATA[<p>PROBLEM Jenkins, for some reason, does not pick up Karma generated JUnit test reports even though they are created in the right directory&#8230; and apparently, it is a known problem. While Freestyle project job allows us to manually publish these JUnit reports, my intention is to rely on Maven project job to do the same [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2014/11/11/jenkins-getting-karma-generated-test-results-to-appear-in-maven-project-job/">Jenkins: Getting Karma Generated Test Results to Appear in Maven Project Job</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">PROBLEM</h2>



<p>Jenkins, for some reason, does not pick up Karma generated JUnit test reports even though they are created in the right directory&#8230; and apparently, it is a known problem. While <b>Freestyle project</b> job allows us to manually publish these JUnit reports, my intention is to rely on <b>Maven project</b> job to do the same thing.</p>



<h2 class="wp-block-heading">PREREQUISITES</h2>



<ul class="wp-block-list">
<li><a href="http://myshittycode.com/2014/11/09/karma-getting-started/" target="_blank" rel="noopener">Karma: Getting Started</a></li>
</ul>



<h2 class="wp-block-heading">ENSURING KARMA GENERATED JUNIT REPORT SHOWS UP IN JENKINS</h2>



<p>Instead of manually running <strong>karma start</strong> command in Jenkins, we will rely on maven-karma-plugin to do this for us. The key here is to specify the correct <strong>&lt;phase&gt;</strong> so that Jenkins picks up and presents the generated report.</p>



<h3 class="wp-block-heading">pom.xml</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; highlight: [9]; title: ; notranslate">
&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;com.kelveden&lt;/groupId&gt;
            &lt;artifactId&gt;maven-karma-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.6&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;phase&gt;process-test-classes&lt;/phase&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;start&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
            &lt;configuration&gt;
                &lt;karmaExecutable&gt;${basedir}/node_modules/karma/bin/karma&lt;/karmaExecutable&gt;
                &lt;configFile&gt;src/test/resources/karma.jenkins.conf.js&lt;/configFile&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</pre></div>


<h2 class="wp-block-heading">CONFIGURING JENKINS</h2>



<p>Since Karma test runner requires NodeJS, we will install <a href="https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin" target="_blank" rel="noopener">NodeJS Plugin</a> in Jenkins. This allows us to automatically install NodeJS from Jenkins.</p>



<p>Once installed, go to <strong>Manage Jenkins -&gt; Configure System</strong> and go to NodeJS section:-</p>



<figure class="wp-block-image aligncenter"><img fetchpriority="high" decoding="async" width="1316" height="352" src="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-45-09-pm-1.png?x45560" alt="" class="wp-image-609" srcset="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-45-09-pm-1.png 1316w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-45-09-pm-1-300x80.png 300w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-45-09-pm-1-1024x274.png 1024w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-45-09-pm-1-768x205.png 768w" sizes="(max-width: 1316px) 100vw, 1316px" /></figure>



<p>Although this section allows us to specify npm packages to install, I&#8217;m having trouble installing certain packages, such as karma-phantomjs-launcher. The phantomJS package invokes <strong>node install.js</strong> during the installation, however, the <strong>node</strong> command isn&#8217;t available in <strong>PATH</strong> environment variable at this point. Thus, the installation will always fail. So, the npm packages will be configured at the job level in the next step. Further, <b>it is not a good idea to install Karma-related plugins globally</b> here because every Jenkins job may use slightly different versions of the same plugin (think Spring or Hibernate versions in every job&#8217;s <strong>pom.xml</strong>).</p>



<p>Next, create a <b>Maven project</b> job and configure it.</p>



<h3 class="wp-block-heading">Configuring Build Environment, Pre Steps and Build</h3>



<p>We exposed NodeJS to <strong>PATH</strong> environment variable so that we can install phantomJS package.</p>



<p>Next, we created a pre-build step to execute <strong>npm install</strong>, which reads <strong>package.json</strong> from the job and installs the needed dependencies within the job.</p>



<p>Finally, we will want Maven to invoke <strong>test</strong> goal so that it runs both Java tests and Karma test runner.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" width="995" height="656" src="https://myshittycode.com/wp-content/uploads/2014/11/screen_shot_2014-11-11_at_8_28_24_am-1.png?x45560" alt="" class="wp-image-661" srcset="https://myshittycode.com/wp-content/uploads/2014/11/screen_shot_2014-11-11_at_8_28_24_am-1.png 995w, https://myshittycode.com/wp-content/uploads/2014/11/screen_shot_2014-11-11_at_8_28_24_am-1-300x198.png 300w, https://myshittycode.com/wp-content/uploads/2014/11/screen_shot_2014-11-11_at_8_28_24_am-1-768x506.png 768w" sizes="(max-width: 995px) 100vw, 995px" /></figure>



<h3 class="wp-block-heading">Configuring Coverage Report</h3>



<p>We provided the Karma generated coverage report XML file.</p>



<figure class="wp-block-image aligncenter"><img decoding="async" width="973" height="210" src="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-05-51-pm-1.png?x45560" alt="" class="wp-image-611" srcset="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-05-51-pm-1.png 973w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-05-51-pm-1-300x65.png 300w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-05-51-pm-1-768x166.png 768w" sizes="(max-width: 973px) 100vw, 973px" /></figure>



<h2 class="wp-block-heading">OUTCOME</h2>



<p>When we run <b>Build Now</b> in Jenkins, both unit test and coverage reports will display both Java and JavaScript execution results.</p>



<figure class="wp-block-image aligncenter"><img loading="lazy" decoding="async" width="781" height="266" src="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-36-pm-1.png?x45560" alt="" class="wp-image-612" srcset="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-36-pm-1.png 781w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-36-pm-1-300x102.png 300w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-36-pm-1-768x262.png 768w" sizes="auto, (max-width: 781px) 100vw, 781px" /></figure>



<figure class="wp-block-image aligncenter"><img loading="lazy" decoding="async" width="781" height="733" src="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-12-pm-1.png?x45560" alt="" class="wp-image-613" srcset="https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-12-pm-1.png 781w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-12-pm-1-300x282.png 300w, https://myshittycode.com/wp-content/uploads/2014/10/screen-shot-2014-10-23-at-1-26-12-pm-1-768x721.png 768w" sizes="auto, (max-width: 781px) 100vw, 781px" /></figure>



<p>Since we ran <strong>npm install</strong> as a pre-build step, the job will now have <strong>node_modules</strong> directory.</p>



<figure class="wp-block-image aligncenter"><img loading="lazy" decoding="async" width="538" height="254" src="https://myshittycode.com/wp-content/uploads/2014/11/screen_shot_2014-11-11_at_8_34_34_am-1.png?x45560" alt="" class="wp-image-662" srcset="https://myshittycode.com/wp-content/uploads/2014/11/screen_shot_2014-11-11_at_8_34_34_am-1.png 538w, https://myshittycode.com/wp-content/uploads/2014/11/screen_shot_2014-11-11_at_8_34_34_am-1-300x142.png 300w" sizes="auto, (max-width: 538px) 100vw, 538px" /></figure>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2014/11/11/jenkins-getting-karma-generated-test-results-to-appear-in-maven-project-job/">Jenkins: Getting Karma Generated Test Results to Appear in Maven Project Job</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2014/11/11/jenkins-getting-karma-generated-test-results-to-appear-in-maven-project-job/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">597</post-id>	</item>
		<item>
		<title>SonarQube: Building Specific Module in Multi-Module Project</title>
		<link>https://myshittycode.com/2014/04/01/sonarqube-building-specific-module-in-multi-module-project/</link>
					<comments>https://myshittycode.com/2014/04/01/sonarqube-building-specific-module-in-multi-module-project/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Tue, 01 Apr 2014 20:37:11 +0000</pubDate>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Jenkins]]></category>
		<category><![CDATA[SonarQube]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=465</guid>

					<description><![CDATA[<p>Let&#8217;s assume we have a multi-module project that looks something like this:- To build certain module(s) within the project, we can use the sonar.skippedModules option to skip the modules we don&#8217;t need. For example, the following configuration in Jenkins will only build app-jar module in SonarQube:-</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2014/04/01/sonarqube-building-specific-module-in-multi-module-project/">SonarQube: Building Specific Module in Multi-Module Project</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Let&#8217;s assume we have a multi-module project that looks something like this:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
├── pom.xml
├── app-jar
│   └── pom.xml
├── app-ear
│   └── pom.xml
└── app-war
    └── pom.xml
</pre></div>


<p>To build certain module(s) within the project, we can use the <strong>sonar.skippedModules</strong> option to skip the modules we don&#8217;t need. For example, the following configuration in Jenkins will only build <strong>app-jar</strong> module in SonarQube:-</p>



<figure class="wp-block-image aligncenter"><img loading="lazy" decoding="async" width="719" height="314" src="https://myshittycode.com/wp-content/uploads/2014/04/screen_shot_2014-04-01_at_3_31_05_pm-1.png?x45560" alt="" class="wp-image-466" srcset="https://myshittycode.com/wp-content/uploads/2014/04/screen_shot_2014-04-01_at_3_31_05_pm-1.png 719w, https://myshittycode.com/wp-content/uploads/2014/04/screen_shot_2014-04-01_at_3_31_05_pm-1-300x131.png 300w" sizes="auto, (max-width: 719px) 100vw, 719px" /></figure>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2014/04/01/sonarqube-building-specific-module-in-multi-module-project/">SonarQube: Building Specific Module in Multi-Module Project</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2014/04/01/sonarqube-building-specific-module-in-multi-module-project/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">465</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Database Caching using Disk

Served from: myshittycode.com @ 2026-02-18 20:59:51 by W3 Total Cache
-->