<?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>JSF Blog &#187; Cobertura</title>
	<atom:link href="http://www.jsfblog.info/tag/cobertura/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jsfblog.info</link>
	<description>Discussion on all things Java and JSF</description>
	<lastBuildDate>Fri, 03 Feb 2012 20:24:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Useful Eclipse Plugins</title>
		<link>http://www.jsfblog.info/2010/11/useful-eclipse-plugins/</link>
		<comments>http://www.jsfblog.info/2010/11/useful-eclipse-plugins/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 12:52:11 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[checkstyle]]></category>
		<category><![CDATA[Cobertura]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[m2eclipse]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[pmd]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=299</guid>
		<description><![CDATA[A list of handy plugins for the Eclipse IDE eCobertura &#8211; Allows Cobertura code coverage to be run from the IDE directly eclipse-cs &#8211; Enforces coding standards using the CheckStyle tool PMD &#8211; Scans Java code and reports potential problems M2Eclipse &#8211; Maven integration from Sonatype m2e-extensions &#8211; Works with version 0.10 of the M2Eclipse [...]]]></description>
			<content:encoded><![CDATA[<p>A list of handy plugins for the <a href="http://www.eclipse.org/">Eclipse IDE</a></p>
<ul>
<li><a href="http://ecobertura.johoop.de/" target="_blank">eCobertura</a> &#8211; Allows <a href="http://cobertura.sourceforge.net/" target="_blank">Cobertura</a> code coverage to be run from the IDE directly</li>
<li><a href="http://eclipse-cs.sourceforge.net/" target="_blank">eclipse-cs</a> &#8211; Enforces coding standards using the <a href="http://eclipse-cs.sourceforge.net/" target="_blank">CheckStyle</a> tool</li>
<li><a href="http://pmd.sourceforge.net/eclipse/" target="_blank">PMD</a> &#8211; Scans Java code and reports potential problems</li>
<li><a href="http://m2eclipse.sonatype.org/" target="_blank">M2Eclipse</a> &#8211; Maven integration from Sonatype
<ul>
<li><a href="http://code.google.com/p/m2e-extensions/" target="_blank">m2e-extensions</a> &#8211; Works with version 0.10 of the M2Eclipse plugin. Can automatically setup Checkstyle and PMD configuration for Eclipse to match their configuration from the pom file if they are in it</li>
<li><a href="http://bimargulies.github.com/m2e-code-quality/" target="_blank">m2e-code-quality</a> &#8211; Same as m2e-extensions, except this one works with version 0.12 of the M2Eclipse plugin</li>
</ul>
</li>
</ul>
<p><strong>Note:</strong> both m2e-extensions and m2e-code-quality only work if you have the pmd and checkstyle plugins configured in the build section of the pom. They do not currently work if you have pmd and checkstyle configured in the reporting section of the pom.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2010/11/useful-eclipse-plugins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cobertura code coverage with Maven and PowerMock</title>
		<link>http://www.jsfblog.info/2010/02/cobertura-code-coverage-with-maven-and-powermock/</link>
		<comments>http://www.jsfblog.info/2010/02/cobertura-code-coverage-with-maven-and-powermock/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 22:09:40 +0000</pubDate>
		<dc:creator>Colin</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Cobertura]]></category>
		<category><![CDATA[PowerMock]]></category>

		<guid isPermaLink="false">http://www.jsfblog.info/?p=56</guid>
		<description><![CDATA[If you use Powermock for unit testing with Maven and Cobertura for code coverage, you are likely to be affected by the following issue noted on the PowerMock issue tracker. If you did not have the maven-surefire-plugin forkmode configured to &#8216;pertest&#8217;, you would find that any tests annotated with @RunWith(PowerMockRunner.class) had zero percentage code coverage [...]]]></description>
			<content:encoded><![CDATA[<p>If you use <a href="http://code.google.com/p/powermock/">Powermock</a> for unit testing with <a href="http://maven.apache.org/">Maven</a> and <a href="http://cobertura.sourceforge.net/">Cobertura</a> for code coverage, you are likely to be affected by the <a href="http://code.google.com/p/powermock/issues/detail?id=122">following issue</a> noted on the PowerMock issue tracker. If you did not have the <a href="http://maven.apache.org/plugins/maven-surefire-plugin/">maven-surefire-plugin</a> forkmode configured to &#8216;pertest&#8217;, you would find that any tests annotated with @RunWith(PowerMockRunner.class) had zero percentage code coverage when you viewed the resulting code coverage report produced by the <a href="http://mojo.codehaus.org/cobertura-maven-plugin/">cobertura-maven-plugin</a>. Whilst running with &#8216;pertest&#8217; fixed the issue, it was very slow to run the Maven build compared against a forkmode of &#8216;once&#8217;.</p>
<p>In September 2009, Cobertura released version 1.9.3 and one of the changes mentioned was the following:</p>
<ul>
<li>Support the case where multiple classloaders each load the Cobertura classes.</li>
</ul>
<p>Seeing this, I decided to test if that would fix the issue. At present, the latest version of the cobertura-maven-plugin is 2.3 which runs with Cobertura 1.9.2. There are some snapshots in the <a href="http://snapshots.repository.codehaus.org/org/codehaus/mojo/cobertura-maven-plugin/">codehaus snapshot repository</a> which run with Cobertura 1.9.3.  However, I found that the snapshots were constantly changing, and each run of the Maven build downloaded the latest version and sometimes the latest version had issues. There is probably a way to stop this from happening but if you don&#8217;t want to use snapshots, there is a change you can make to the 2.3 version which will also fix the issue. The cobertura-maven-plugin-2.3.pom file needs to be edited. It can be found in your repository under the following directory: org/codehaus/mojo/cobertura-maven-plugin/2.3/</p>
<p>Find the dependencies section of the pom file and change the versions of Cobertura from 1.9.2 to 1.9.3. There are two instances that need changing:</p>
<pre class="brush: xml; highlight: [4,9]; title: ; notranslate">
&lt;dependency&gt;
	&lt;groupId&gt;net.sourceforge.cobertura&lt;/groupId&gt;
	&lt;artifactId&gt;cobertura&lt;/artifactId&gt;
	&lt;version&gt;1.9.3&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
	&lt;groupId&gt;net.sourceforge.cobertura&lt;/groupId&gt;
	&lt;artifactId&gt;cobertura-runtime&lt;/artifactId&gt;
	&lt;version&gt;1.9.3&lt;/version&gt;
	&lt;type&gt;pom&lt;/type&gt;
&lt;/dependency&gt;
</pre>
<p>With that change, you should find that you can safely remove the &#8216;pertest&#8217; forkmode configuration since by default the surefire plugin will run with forkmode set to &#8216;once&#8217;, and your cobertura code coverage results should be reporting correctly.</p>
<h5>UPDATE (26th April 2010):</h5>
<p>There is actually a better way of doing this which doesn&#8217;t involve having to edit the pom file for the actual plugin.</p>
<p>In your pom file you will have defined the cobertura-maven-plugin in the reporting section. The reporting section does not allow to add dependencies to a plugin. However the build section does, and the plugins defined in the reporting section will also pick up those dependencies. Therefore, you can also define the cobertura-maven-plugin in the build section as a plugin. This will allow you to specify some dependencies, as shown below.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;build&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
			&lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
			&lt;version&gt;2.3&lt;/version&gt;
			&lt;dependencies&gt;
				&lt;dependency&gt;
					&lt;groupId&gt;net.sourceforge.cobertura&lt;/groupId&gt;
					&lt;artifactId&gt;cobertura&lt;/artifactId&gt;
					&lt;version&gt;1.9.4.1&lt;/version&gt;
				&lt;/dependency&gt;
				&lt;dependency&gt;
					&lt;groupId&gt;net.sourceforge.cobertura&lt;/groupId&gt;
					&lt;artifactId&gt;cobertura-runtime&lt;/artifactId&gt;
					&lt;version&gt;1.9.4.1&lt;/version&gt;
					&lt;type&gt;pom&lt;/type&gt;
				&lt;/dependency&gt;
			&lt;/dependencies&gt;
		&lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</pre>
<p>This will then use cobertura 1.9.4.1.  Any version above 1.9.2 should fix the issue, but 1.9.4.1 is currently the latest and supposedly a lot faster than previous versions.</p>
<h5>UPDATE (11th May 2010):</h5>
<p>Good news! There is now version 2.4 of the cobertura-maven-plugin. This uses 1.9.4.1 version of Cobertura, so none of the above is now necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jsfblog.info/2010/02/cobertura-code-coverage-with-maven-and-powermock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

