<?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>javablog.ch&#187; Maven</title>
	<atom:link href="http://www.javablog.ch/category/maven-mediator/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javablog.ch</link>
	<description>Keep on learning...</description>
	<lastBuildDate>Sun, 04 Dec 2011 17:15:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Statische Codeanalysen mit Maven 2</title>
		<link>http://www.javablog.ch/2009/09/13/statische-codeanalysen-mit-maven-2/</link>
		<comments>http://www.javablog.ch/2009/09/13/statische-codeanalysen-mit-maven-2/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 18:08:09 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2009/09/13/statische-codeanalysen-mit-maven-2/</guid>
		<description><![CDATA[Zur Qualitätssicherung eines Softwareprojekts gehören neben Unittests auch statische Codeanalysen. Tools wie Checkstyle, Findbugs oder PMD untersuchen Java-Klassen und bewerten den Code anhand verschiedener Metriken. Zwar können diese Checks einen manuellen Codereview nicht ersetzen, aber Standardfehler und bekannte Anti-Patterns werden zuverlässig erkannt. Für jedes der genannten Tools gibt es ein Eclipse-Plugin, das die betreffenden Codestellen [...]]]></description>
			<content:encoded><![CDATA[<p>Zur Qualitätssicherung eines Softwareprojekts gehören neben Unittests auch statische Codeanalysen. Tools wie <a href="http://checkstyle.sourceforge.net/">Checkstyle</a>, <a href="http://findbugs.sourceforge.net/">Findbugs</a> oder <a href="http://pmd.sourceforge.net/">PMD</a> untersuchen Java-Klassen und bewerten den Code anhand verschiedener Metriken. </p>
<p>Zwar können diese Checks einen manuellen Codereview nicht ersetzen, aber Standardfehler und bekannte Anti-Patterns werden zuverlässig erkannt. Für jedes der genannten Tools gibt es ein Eclipse-Plugin, das die betreffenden Codestellen markiert. Die Anzeige der Fehler ist aber nicht ausreichend: Bei schwerwiegenden Verstössen soll auch der Build scheitern, ansonsten besteht die Gefahr, dass der Code nicht korrigiert wird. Aber wie kann man das umsetzen ? </p>
<p>Mit Maven 2 geht dies einfach mit einer Plugin-Konfiguration innerhalb des &#8220;build&#8221;-Elements. </p>
<p>Hier ein Projektbeispiel für die PMD Analyse:</p>
<div class="codeblock">
<div class="xml" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;build<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;plugins<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;plugin<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;groupId<span style="font-weight: bold; color: black;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/groupId<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;artifactId<span style="font-weight: bold; color: black;">&gt;</span></span></span>maven-pmd-plugin<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/artifactId<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;configuration<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;sourceEncoding<span style="font-weight: bold; color: black;">&gt;</span></span></span>${file.encoding}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/sourceEncoding<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;minimumTokens<span style="font-weight: bold; color: black;">&gt;</span></span></span>100<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/minimumTokens<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;targetJdk<span style="font-weight: bold; color: black;">&gt;</span></span></span>${java.target.version}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/targetJdk<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;failOnViolation<span style="font-weight: bold; color: black;">&gt;</span></span></span>true<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/failOnViolation<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;failurePriority<span style="font-weight: bold; color: black;">&gt;</span></span></span>2<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/failurePriority<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/configuration<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;version<span style="font-weight: bold; color: black;">&gt;</span></span></span>${pmd.version}<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/version<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;executions<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;execution<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;goals<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;goal<span style="font-weight: bold; color: black;">&gt;</span></span></span>check<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/goal<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;goal<span style="font-weight: bold; color: black;">&gt;</span></span></span>cpd-check<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/goal<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/goals<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/execution<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/executions<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/plugin<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/plugins<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/build<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li></ol></div>
</div>
<p>Mit dieser einfachen Konfiguration wird sichergestellt, dass der Code keine PMD-Verstösse der Kategorie 1 und 2  enthält. Zudem ist garantiert, dass der Build bei Copy&#038;Paste von 100 Wörtern (bzw. Tokens) scheitert. Praktisch !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2009/09/13/statische-codeanalysen-mit-maven-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Praktisch: Maven-Help-Plugin</title>
		<link>http://www.javablog.ch/2009/07/18/praktisch-maven-help-plugin/</link>
		<comments>http://www.javablog.ch/2009/07/18/praktisch-maven-help-plugin/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 21:34:27 +0000</pubDate>
		<dc:creator>HeikoMaass</dc:creator>
				<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://www.javablog.ch/2009/07/18/praktisch-maven-help-plugin/</guid>
		<description><![CDATA[Apache Maven ist ein fantastisches Buildsystem, allerdings sind manche Plugins eher spartanisch dokumentiert. Für mehr Klarheit sorgt das maven-help-plugin mit seinem &#8220;describe&#8220;-goal, welches alle Goals eines Plugins inkl. der möglichen Parameter beschreibt. Beispielaufruf: mvn help:describe -Dplugin=org.codehaus.mojo:findbugs-maven-plugin -Dfull Ebenso hilfreich ist das &#8220;effective-pom&#8220;-goal, mit dem ein POM inkl. aller geerbten Eigenschaften ausgegeben wird. Vor allem bei [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://maven.apache.org">Apache Maven</a> ist ein fantastisches Buildsystem, allerdings sind manche Plugins eher spartanisch dokumentiert. Für mehr Klarheit sorgt das maven-help-plugin mit seinem &#8220;<strong>describe</strong>&#8220;-goal, welches alle Goals eines Plugins inkl. der möglichen Parameter beschreibt. Beispielaufruf:</p>
<p><code>mvn help:describe -Dplugin=org.codehaus.mojo:findbugs-maven-plugin -Dfull</code></p>
<p>Ebenso hilfreich ist das &#8220;<strong>effective-pom</strong>&#8220;-goal,  mit dem ein POM inkl. aller geerbten Eigenschaften ausgegeben wird. Vor allem bei grossen Projekten mit vielen Parents ist die generierte Übersicht hilfreich. Beispiel:</p>
<p><code>mvn help:effective-pom</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.javablog.ch/2009/07/18/praktisch-maven-help-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

