<?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>Glen Smith &#187; Maven</title>
	<atom:link href="http://blogs.bytecode.com.au/glen/category/maven/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.bytecode.com.au/glen</link>
	<description>Java, XML and all that Jazz... from Canberra, Australia</description>
	<lastBuildDate>Fri, 12 Apr 2013 04:17:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Maven Tip: Enforcing a JDK version in your build</title>
		<link>http://blogs.bytecode.com.au/glen/2009/09/15/maven-tip-enforcing-a-jdk-version-in-your-build.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2009/09/15/maven-tip-enforcing-a-jdk-version-in-your-build.html#comments</comments>
		<pubDate>Tue, 15 Sep 2009 01:29:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2009/09/15/maven-tip-enforcing-a-jdk-version-in-your-build/</guid>
		<description><![CDATA[You&#8217;ve just got to love the Maven Enforcer plugin. Anything with a byline of &#8220;The Loving Iron Fist of Maven&#8221; has got to endear you, no? The Enforcer is a collection of configurable rules that will force your build to stop if certain preconditions are not met. One of the common ways I&#8217;ve been using [...]]]></description>
				<content:encoded><![CDATA[<p>
You&#8217;ve just got to love the <a href="http://maven.apache.org/plugins/maven-enforcer-plugin/">Maven Enforcer plugin</a>. Anything with a byline of &#8220;The Loving Iron Fist of Maven&#8221; has got to endear you, no?
</p>
<p>
The Enforcer is a collection of configurable rules that will force your build to stop if certain preconditions are not met. One of the common ways I&#8217;ve been using it lately is to ensure that a certain JDK (1.4 in my case &#8211; don&#8217;t get me started on Websphere) is used when producing production artifacts.
</p>
<p>
I know what you&#8217;re thinking, just use the &lt;target&gt; config attribute to the compiler plugin? That would be true if the -target switches to the JDK compiler actually <a href="http://madbean.com/2006/target14/">did what you think</a>. But alas that is not the case unless you do funkiness with <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javac.html#crosscomp-example">paths to the 1.4 runtime with a -bootclasspath option</a> which sounds just too fragile and machine-specific. I&#8217;d prefer to just bomb out early if it&#8217;s not a real 1.4 JDK. I&#8217;m really dislike that <code>java.lang.NoSuchMethodError</code> stuff.
</p>
<p>
Anyways, here&#8217;s the build kungfu to ensure you enforce your preferred JDK:
</p>
<pre class="prettyprint">
&lt;plugin&gt;
	&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
	&lt;artifactId&gt;maven-enforcer-plugin&lt;/artifactId&gt;
	&lt;version&gt;1.0-beta-1&lt;/version&gt;
	&lt;executions&gt;
		&lt;execution&gt;
			&lt;id&gt;enforce-versions&lt;/id&gt;
			&lt;phase&gt;validate&lt;/phase&gt;
			&lt;goals&gt;
				&lt;goal&gt;enforce&lt;/goal&gt;
			&lt;/goals&gt;
			&lt;configuration&gt;
				&lt;rules&gt;
					&lt;requireJavaVersion&gt;
						&lt;version&gt;[1.4,1.5)&lt;/version&gt;
					&lt;/requireJavaVersion&gt;
				&lt;/rules&gt;
			&lt;/configuration&gt;
		&lt;/execution&gt;
	&lt;/executions&gt;
&lt;/plugin&gt;
</pre>
<p>
Putting the goal against the validate phase makes everything die early. However, you might want to bind to "install" or whatever if you're happy to develop against a later JDK. Giving this bad boy a run on Snow Leopard will give you output like:
</p>
<pre>
[INFO] [enforcer:enforce {execution: enforce-versions}]
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireJavaVersion
failed with message:
Detected JDK Version: 1.6.0-15 is not in the allowed range [1.4,1.5).
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Some Enforcer rules have failed. Look above for specific messages
explaining why the rule failed.
</pre>
<p>
Giddy up. Die early, die often.
</p>
<p>
I&#8217;m definitely making room for the Enforcer plugin in my <a href="http://www.bytecode.com.au/site/display/external/Maven+Quickstart">Maven Quickstart Course</a> running in Canberra next month. It&#8217;s gonna be a blast &#8211; and there&#8217;s still early bird pricing for the next week so if you&#8217;re interested in getting there, don&#8217;t forget to register early!
</p>
<p>
Enjoy the loving iron fist!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2009/09/15/maven-tip-enforcing-a-jdk-version-in-your-build.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>opencsv 2.0 released and mavenized (Sonatype totally rock!)</title>
		<link>http://blogs.bytecode.com.au/glen/2009/08/25/opencsv-2-0-released-and-mavenized-sonatype-totally-rock.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2009/08/25/opencsv-2-0-released-and-mavenized-sonatype-totally-rock.html#comments</comments>
		<pubDate>Tue, 25 Aug 2009 00:51:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2009/08/25/opencsv-2-0-released-and-mavenized-sonatype-totally-rock/</guid>
		<description><![CDATA[People who follow opencsv will find this hard to believe &#8212; but it actually happened! Thanks to a whole lot of work from Scott Conway, a whole slew of patches have been applied to opencsv 2.0 is out in the wild! Scott has fixed heaps of the outstanding issues, so if you&#8217;ve opened something, make [...]]]></description>
				<content:encoded><![CDATA[<p>
People who follow opencsv will find this hard to believe &#8212; but it actually happened! Thanks to a whole lot of work from Scott Conway, a whole slew of patches have been applied to <a href="http://opencsv.sf.net">opencsv</a> 2.0 is out in the wild! Scott has fixed heaps of the outstanding issues, so if you&#8217;ve opened something, make sure you check back to see if it made it in (it probably did!). We&#8217;ll have some formal release notes up there soon.
</p>
<p>
At the same time as Scott was patching, I took the chance to Mavenize the project as a good sample for my little <a href="http://www.bytecode.com.au/site/display/external/Maven+Quickstart">Maven Quickstart</a> course. Getting stuff into Maven Central has traditionally been a bit of a pain, but the good folk at Sonatype now have a fantastic Nexus setup that mirrors to central frequently (opencsv went from the Sonatype Nexus repo through to central in under 10 minutes &#8211; apparently the servers are in the same rack!).
</p>
<p>
Go and check out this <a href="http://www.sonatype.com/people/2009/06/publishing-your-artifacts-to-the-central-maven-repository/">Sonatype blog entry</a> to get the skinny. Basically, you post a JIRA requesting access, they email you a username, password, and a set of repo address. Deploy your app, and they&#8217;ll sort out the sync to Central for you.
</p>
<p>
The only tricky part of the process was implementing the required GPG signing using the <a href="http://www.sonatype.com/people/2009/06/publishing-your-artifacts-to-the-central-maven-repository/">gpg plugin</a>, but other than that life was grand! Have a look at the opencsv <a href="https://opencsv.svn.sourceforge.net/svnroot/opencsv/trunk/pom.xml">pom</a> for sample usage. I could install the gpg binary via macports, and use a <a href="http://www.madboa.com/geek/gpg-quickstart/">gpg quickstart</a> to workout how to generate and export keys.
</p>
<p>
I&#8217;ve been a big fan of <a href="http://www.sonatype.com/products/nexus">Nexus</a> as a repository manager for ages. But what they&#8217;ve done with this central setup has been a *huge* boon for opensource projects wanting to sync up to central. Makes the process totally straightforward.
</p>
<p>
Awesome job Sonatype!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2009/08/25/opencsv-2-0-released-and-mavenized-sonatype-totally-rock.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Maven is the new black: Canberra JUG Presentation, Wed Aug 12</title>
		<link>http://blogs.bytecode.com.au/glen/2009/08/03/maven-is-the-new-black-canberra-jug-presentation-wed-aug-12.html</link>
		<comments>http://blogs.bytecode.com.au/glen/2009/08/03/maven-is-the-new-black-canberra-jug-presentation-wed-aug-12.html#comments</comments>
		<pubDate>Mon, 03 Aug 2009 04:24:00 +0000</pubDate>
		<dc:creator>Glen</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://blogs.bytecode.com.au/glens/2009/08/03/maven-is-the-new-black-canberra-jug-presentation-wed-aug-12/</guid>
		<description><![CDATA[If you&#8217;re around Canberra on Wednesday, August 12, make sure you drop by the Canberra Java User Group (CJUG) from 6PM where I&#8217;ll be giving a talk title &#8220;Maven is the new black&#8221;. Maven has really been gaining popularity lately in the Java ecosystem, so it&#8217;s a good chance to come along and hear what [...]]]></description>
				<content:encoded><![CDATA[<p>
If you&#8217;re around Canberra on Wednesday, August 12, make sure you drop by the <a href="http://cjugaustralia.org/">Canberra Java User Group</a> (CJUG) from 6PM where I&#8217;ll be giving a talk title &#8220;Maven is the new black&#8221;. Maven has really been gaining popularity lately in the Java ecosystem, so it&#8217;s a good chance to come along and hear what all the fuss is about.
</p>
<p>
Maven is full of features, but often a little short on &#8220;getting your head around it&#8221; material, so I&#8217;ll be giving a short 30 minute talk which just takes you through the basics of the core stuff you need to explore and gives you some demos of the benefits. On the list is a thumbnail sketch of:
</p>
<ul>
<li>Comparison with Ant
<li>Convention over configuration stuff
<li>Dependencies and Repos
<li>POMs, Plugins and the Build lifecycle
<li>Site Generation and Reporting
<li>IDE Support
</ul>
<p>
If you&#8217;re keen to go a bit deeper and actually learn how to apply all this stuff to real projects, I&#8217;ll also be offering a one day intensive title &#8220;<a href="http://www.bytecode.com.au/site/display/external/Maven+Quickstart">Maven Quickstart</a>&#8221; which I&#8217;m offering on October 22 in Canberra. It promises to be a really fun day with heaps of challenging lab exercises while keeping things fun and practical. If there&#8217;s interest, I&#8217;m hoping to offer it in Sydney, Melbourne, and Brisbane, since there seems to be a real shortage of Maven training options here in Oz. Talk to me if you have people in your space that could benefit.
</p>
<p>
Anyways, If you&#8217;re in town, see you for Pizza and Maven next week!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.bytecode.com.au/glen/2009/08/03/maven-is-the-new-black-canberra-jug-presentation-wed-aug-12.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
