<?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>Jabbering Giraffe &#187; maven</title>
	<atom:link href="http://happygiraffe.net/blog/tag/maven/feed/" rel="self" type="application/rss+xml" />
	<link>http://happygiraffe.net/blog</link>
	<description></description>
	<lastBuildDate>Wed, 19 Oct 2011 10:40:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>The importance of Central</title>
		<link>http://happygiraffe.net/blog/2009/08/23/the-importance-of-central/</link>
		<comments>http://happygiraffe.net/blog/2009/08/23/the-importance-of-central/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 22:33:05 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1588</guid>
		<description><![CDATA[One of the selling points of maven is it&#8217;s dependency mechanism. You say what code you need, and maven makes sure it&#8217;s there for you. The magic behind this is called central. It&#8217;s a phenomenal collection of software (much akin &#8230; <a href="http://happygiraffe.net/blog/2009/08/23/the-importance-of-central/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the selling points of maven is it&#8217;s dependency mechanism.  You say what code you need, and maven makes sure it&#8217;s there for you.  The magic behind this is called <a href="http://repo1.maven.org/maven2/">central</a>.  It&#8217;s a phenomenal collection of software (much akin to Perl&#8217;s <a href="http://search.cpan.org/">CPAN</a>).</p>
<p>This is useful enough that other projects have sprung up that also use central, like <a href="http://ant.apache.org/ivy/">apache ivy</a>.</p>
<p>Central also has source code jars (most of the time).  This means it&#8217;s possible to jump from your piece of code seamlessly into 3rd party code that&#8217;s available on central.  I can&#8217;t imagine getting up to speed with other people&#8217;s code anywhere near as quickly without this sort of facility available.  Sure, the source is available, but is it a single click away from your code?  Not likely.  <a href="http://m2eclipse.sonatype.org/">m2eclipse</a> and <a href="http://www.netbeans.org/community/releases/67/">NetBeans 6.7</a> make this trivial.</p>
<p>So, having your open source project on central is a really good idea.  It lets your users get at it easily and automatically.  You really want to do this.</p>
<p>However, getting your projects on to central isn&#8217;t simple (see <a href="http://maven.apache.org/guides/mini/guide-central-repository-upload.html">Guide to uploading artifacts to the Central Repository</a>).  It boils down to two choices:</p>
<ul>
<li>Package up your code using <a href="http://maven.apache.org/plugins/maven-repository-plugin/bundle-create-mojo.html"><code>mvn repository:bundle-create</code></a> and file a <a href="http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&#038;&#038;pid=10367&#038;resolution=-1&#038;sorter/field=updated&#038;sorter/order=DESC">Jira issue</a> for it.  This can take four weeks or more.</li>
<li>Set up and host an <a href="http://www.samba.org/rsync/">rsync</a>able repository somewhere.  This can be automatically pulled into central.</li>
</ul>
<p>Both of these options are fairly painful.  That&#8217;s why for the latest release of <a href="http://code.google.com/p/jslint4java/">jslint4java</a>, I was pleased to see that <a href="http://www.sonatype.com/">Sonatype</a> are offering an alternative: <a href="https://docs.sonatype.com/display/NX/OSS+Repository+Hosting">oss.sonatype.org</a>.  This is much simpler because you can just use the usual maven deployment mechanism (or presumably ivy equivalent).  A short while later, oss.sonatype.org will sync up with central.</p>
<p>However, the sonatype guys are (rightly) concerned with the quality of artifacts on central.  You have to jump extra hoops to go down this road with your open source projects.  The main one that tripped me up was requiring all artifacts be GPG signed, which entailed learning <a href="http://www.gnupg.org/">GPG</a> and the <a href="http://maven.apache.org/plugins/maven-gpg-plugin/">maven-gpg-plugin</a>.  This took me some time.  However, subsequent releasing to central is much easier now I&#8217;ve been through all the hoops.</p>
<ul>
<li>If you want to get your open source project on central, I&#8217;d definitely recommend checking out oss.sonatype.org.</li>
<li>If you want to contribute to an open source project, offering to help get it on to central could be very useful.  You&#8217;ll not just be helping that project, you&#8217;ll also be helping all users of central.  The bigger it gets the more useful it is.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/08/23/the-importance-of-central/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Documenting with maven</title>
		<link>http://happygiraffe.net/blog/2009/07/31/documenting-with-maven/</link>
		<comments>http://happygiraffe.net/blog/2009/07/31/documenting-with-maven/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 19:11:19 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[docs]]></category>
		<category><![CDATA[jslint4java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1576</guid>
		<description><![CDATA[Recently, I&#8217;ve been thinking about documentation more and more. I&#8217;ve just finished up some documentation for an internal product, which was all done using the maven-site-plugin and APT. This worked reasonably well: I get a generated website, with javadocs and &#8230; <a href="http://happygiraffe.net/blog/2009/07/31/documenting-with-maven/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve been thinking about documentation more and more.  I&#8217;ve just finished up some documentation for an internal product, which was all done using the <a href="http://maven.apache.org/plugins/maven-site-plugin/">maven-site-plugin</a> and <a href="http://maven.apache.org/doxia/references/apt-format.html">APT</a>.  This worked reasonably well: I get a generated website, with javadocs and a few howto pages I wrote.</p>
<p>But it really feels like it starts to fall apart when you get to a multimodule build.  Maven does quite a few nice things for you, but you start to see some annoying glitches here.  One of the first ones I came across was the <a href="http://maven.apache.org/pom.html#Quick_Overview">url</a> element.  If you set it correctly in the root pom (e.g. <code>http://mycompany.com/project/</code>) then maven automatically appends the artifactId when constructing the site for submodules.  So you end up with <code>http://mycompany.com/project/mysubmodule/</code>, which isn&#8217;t necessarily correct.</p>
<p>After thinking about this for a while, and how best to document <a href="http://code.google.com/p/jslint4java/">jslint4java</a>, I&#8217;ve come to the same realisation as Mark Pilgrim: <a href="http://diveintomark.org/archives/2009/03/27/dive-into-history-2009-edition">plain old HTML works best</a>.  I&#8217;ve tried a few like <a href="http://www.textism.com/tools/textile/">Textile</a> (yuck), <a href="http://daringfireball.net/projects/markdown/">Markdown</a> (better), <a href="http://perldoc.perl.org/perlpod.html">POD</a> (too simple) and <a href="http://www.docbook.org/">docbook</a> (too complex).  HTML strikes the right balance.  Especially with the new HTML5 tags.  And it doesn&#8217;t require any building to view it.  Just hit refresh.</p>
<p>So how to make it part of the maven build?  Easy.  Stuff it into it&#8217;s own submodule.  Then, it can be referenced by the assembly plugin later and put in the correct place in your distribution.  Check out <a href="http://github.com/happygiraffe/jslint4java/tree/8132993b1dab1f25bc1b1b9e9ae3eb073453322c/jslint4java-docs">jslint4java-docs</a> for details.  It would be nice if maven natively supported <a href="http://jira.codehaus.org/browse/MNG-1683">zip packaging</a>, but that&#8217;s easily overcome.</p>
<p>This does mean it doesn&#8217;t get automatically deployed to a server.  But that doesn&#8217;t really matter.  It happens infrequently enough that I&#8217;m happy to do that by hand where needed.  Or at least find a better solution when I get bored of that. <img src='http://happygiraffe.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/07/31/documenting-with-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jslint4maven</title>
		<link>http://happygiraffe.net/blog/2009/07/28/jslint4maven/</link>
		<comments>http://happygiraffe.net/blog/2009/07/28/jslint4maven/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 21:13:52 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[jslint4java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1570</guid>
		<description><![CDATA[A real maven plugin for jslint4java would be nice. I will write one, but until then, you can always get away with using the antrun plugin. This is fairly simple to do now that jslint4java is available in the central &#8230; <a href="http://happygiraffe.net/blog/2009/07/28/jslint4maven/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A real maven plugin for jslint4java would be nice.  I will write one, but until then, you can always get away with using the <a href="http://maven.apache.org/plugins/maven-antrun-plugin">antrun plugin</a>.  This is fairly simple to do now that jslint4java is <a href="http://repo1.maven.org/maven2/com/googlecode/jslint4java/">available</a> in the central maven repository.</p>
<p>Here&#8217;s a plugin definition of how to do it.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-antrun-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.googlecode.jslint4java<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jslint4java-ant<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jslint<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>run<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ant</span> <span style="color: #000066;">antfile</span>=<span style="color: #ff0000;">&quot;${basedir}/jslint.xml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;root&quot;</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${basedir}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jslint&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ant<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
              <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Notice how you can add the jslint4java-ant dependency to the antrun plugin without affecting the dependencies of the project.</p>
<p>At the test phase, maven will now run jslint for you.  This relies on a small external ant build file to actually perform the jslint task.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- jslint.xml --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">xmlns:jsl</span>=<span style="color: #ff0000;">&quot;antlib:com.googlecode.jslint4java&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jslint&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jsl:jslint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;formatter</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;plain&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${root}/src/main/webapp&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;**/*.js&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jsl:jslint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>We can use the nice <a href="http://ant.apache.org/manual/CoreTypes/antlib.html#antlibnamespace">antlibs namespace</a> style of declaration because the jslint4java jar is in the classpath already.</p>
<p>Here, I&#8217;m assuming that we&#8217;re in a war project and want to validate all the files under <code>src/main/webapp</code>.  If this goes wrong, you&#8217;ll get an error and the build will stop.  For example:</p>

<div class="wp_syntax"><div class="code"><pre class="none" style="font-family:monospace;">…
Tests run: 26, Failures: 0, Errors: 0, Skipped: 0
&nbsp;
[INFO] [antrun:run {execution: jslint}]
[INFO] Executing tasks
&nbsp;
jslint:
[jsl:jslint] contact.js:1:8:Bad line breaking before '+'.
[jsl:jslint]         + &quot; Nulla in felis Aliquam luctus Proin tincidunt nisi Donec suscipit&quot;
[jsl:jslint]         ^
…
[jsl:jslint] load.js:17:6:Missing semicolon.
[jsl:jslint]     })
[jsl:jslint]       ^
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: The following error occurred while executing this line:
/Users/dom/work/someproj/jslint.xml:4: 3 files did not pass JSLint</pre></div></div>

<p>One side note: originally, I tried to fold the <code>jslint.xml</code> file into the POM as well.  But this failed to load the antlib.  I suspect that xmlns attributes were not being passed in to the tasks definition.  It&#8217;s not a big deal..</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/07/28/jslint4maven/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Conditional maven modules</title>
		<link>http://happygiraffe.net/blog/2009/07/26/conditional-maven-modules/</link>
		<comments>http://happygiraffe.net/blog/2009/07/26/conditional-maven-modules/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 23:13:19 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1566</guid>
		<description><![CDATA[This is a little something that&#8217;s now caught me out a few times. Quite often, I&#8217;ll have a project with a parent POM, and a module that I only care about in certain circumstances. So I naturally do this. &#60;!-- &#8230; <a href="http://happygiraffe.net/blog/2009/07/26/conditional-maven-modules/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a little something that&#8217;s now caught me out a few times.  Quite often, I&#8217;ll have a project with a parent POM, and a module that I only care about in certain circumstances.  So I naturally do this.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #808080; font-style: italic;">&lt;!-- foo/pom.xml --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-core<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-webapp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>dist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-dist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Unfortunately, this can interact badly with the <a href="http://maven.apache.org/plugins/maven-release-plugin/">release plugin</a>.  Unless that profile is activated during release, the module won&#8217;t have it&#8217;s version updated.  So the next time you use that profile, it&#8217;ll break.</p>
<p>The correct solution is to &#8220;push down&#8221; the profile into the <code>foo-dist</code> module.  i.e.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #808080; font-style: italic;">&lt;!-- foo/pom.xml --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-parent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-core<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-webapp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-dist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/module<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/modules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- foo/foo-dist/pom.xml --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-dist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>foo-parent<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.0-SNAPSHOT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/parent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>dist<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #808080; font-style: italic;">&lt;!-- add dependencies &amp; plugins here --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>That way, <code>foo-dist</code> is always available, but is a noop unless the profile is activated.  But it does ensure that the release plugin (and also the <a href="http://mojo.codehaus.org/versions-maven-plugin/">versions plugin</a>) know that it&#8217;s there.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/07/26/conditional-maven-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Java 6 based Eclipse with Cocoa</title>
		<link>http://happygiraffe.net/blog/2009/07/15/using-a-java-6-based-eclipse-with-cocoa/</link>
		<comments>http://happygiraffe.net/blog/2009/07/15/using-a-java-6-based-eclipse-with-cocoa/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 19:37:57 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1553</guid>
		<description><![CDATA[This is somewhat niche, but I&#8217;m going to post it anyway in case it helps somebody else… I recently saw a problem with Eclipse and m2eclipse. When I tried to import a Java 6 based project, I got an error &#8230; <a href="http://happygiraffe.net/blog/2009/07/15/using-a-java-6-based-eclipse-with-cocoa/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is somewhat niche, but I&#8217;m going to post it anyway in case it helps <a href="http://archive.m2eclipse.codehaus.org/lists/org.codehaus.m2eclipse.user/msg/24497016.post@talk.nabble.com">somebody else</a>…</p>
<p>I recently saw a problem with Eclipse and <a href="http://m2eclipse.codehaus.org/">m2eclipse</a>.  When I tried to import a Java 6 based project, I got an error in the maven console.</p>
<pre>
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6
Usage: javac
<options> <source files>
where possible options include:
 -g                         Generate all debugging info
 -g:none                    Generate no debugging info
 -g:{lines,vars,source}     Generate only some debugging info
 -nowarn                    Generate no warnings
 -verbose                   Output messages about what the compiler is doing
</pre>
<p>This is happening because m2eclipse is trying to run the compiler from within the same JVM that Eclipse is running.  And by the <a href="http://www.eclipse.org/downloads/">eclipse.org downloads</a> only offer Carbon and Cocoa options.  Both of these are 32 bit.  Which means they&#8217;ll only ever run using Java 5, even if you&#8217;ve got Java 6 installed (unlike my iMac G5, <em>grumble, grumble</em>).</p>
<p>Thankfully, the 64 cocoa version is available, though it&#8217;s only the old &#8220;Eclipse SDK&#8221; download.  But <a href="http://ekkescorner.wordpress.com/">ekke</a> wrote up <a href="http://ekkescorner.wordpress.com/2009/06/30/galileo-epp-for-cocoa-64-bit/">[galileo] EPP for Cocoa 64-bit</a>, which shows how to go about getting (effectively) the same setup as the eclipse.org downloads.</p>
<p>If you follow along that procedure, you get an eclipse that works well with m2eclipse and Java 6 project.  As a bonus, it feels quicker to me.</p>
<p>Hopefully future versions of Eclipse will offer a 64-bit cocoa download.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/07/15/using-a-java-6-based-eclipse-with-cocoa/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>gnupg very basically</title>
		<link>http://happygiraffe.net/blog/2009/06/24/gnupg-very-basically/</link>
		<comments>http://happygiraffe.net/blog/2009/06/24/gnupg-very-basically/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 20:56:48 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1543</guid>
		<description><![CDATA[I&#8217;m trying to get jslint4java into central, via oss.sonatype.org. Part of this requires that you use the maven-gpg-plugin to sign your artifacts. All well &#038; good, but I&#8217;ve never used GPG before (though I&#8217;ve been playing with SSL certificates for &#8230; <a href="http://happygiraffe.net/blog/2009/06/24/gnupg-very-basically/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to get <a href="http://code.google.com/p/jslint4java/">jslint4java</a> into <a href="http://repo1.maven.org/maven2/">central</a>, via <a href="https://docs.sonatype.com/display/NX/OSS+Repository+Hosting">oss.sonatype.org</a>.  Part of this requires that you use the <a href="http://maven.apache.org/plugins/maven-gpg-plugin/">maven-gpg-plugin</a> to sign your artifacts.  All well &#038; good, but I&#8217;ve never used <a href="http://www.gnupg.org/">GPG</a> before (though I&#8217;ve been playing with SSL certificates for years).</p>
<p>So, following along the <a href="http://www.dewinter.com/gnupg_howto/english/GPGMiniHowto-3.html">howto</a>, I did:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ gpg <span style="color: #660033;">--gen-key</span>
gpg <span style="color: #7a0874; font-weight: bold;">&#40;</span>GnuPG<span style="color: #7a0874; font-weight: bold;">&#41;</span> 1.4.9; Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>C<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">2008</span> Free Software Foundation, Inc.
This is <span style="color: #c20cb9; font-weight: bold;">free</span> software: you are <span style="color: #c20cb9; font-weight: bold;">free</span> to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
&nbsp;
Please <span style="color: #000000; font-weight: bold;">select</span> what kind of key you want:
   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> DSA and Elgamal <span style="color: #7a0874; font-weight: bold;">&#40;</span>default<span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> DSA <span style="color: #7a0874; font-weight: bold;">&#40;</span>sign only<span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> RSA <span style="color: #7a0874; font-weight: bold;">&#40;</span>sign only<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Your selection? <span style="color: #000000;">1</span>
DSA keypair will have <span style="color: #000000;">1024</span> bits.
ELG-E keys may be between <span style="color: #000000;">1024</span> and <span style="color: #000000;">4096</span> bits long.
What keysize <span style="color: #000000; font-weight: bold;">do</span> you want? <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2048</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Requested keysize is <span style="color: #000000;">2048</span> bits
Please specify how long the key should be valid.
         <span style="color: #000000;">0</span> = key does not expire
      <span style="color: #000000; font-weight: bold;">&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span>  = key expires <span style="color: #000000; font-weight: bold;">in</span> n days
      <span style="color: #000000; font-weight: bold;">&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #c20cb9; font-weight: bold;">w</span> = key expires <span style="color: #000000; font-weight: bold;">in</span> n weeks
      <span style="color: #000000; font-weight: bold;">&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span>m = key expires <span style="color: #000000; font-weight: bold;">in</span> n months
      <span style="color: #000000; font-weight: bold;">&lt;</span>n<span style="color: #000000; font-weight: bold;">&gt;</span>y = key expires <span style="color: #000000; font-weight: bold;">in</span> n years
Key is valid <span style="color: #000000; font-weight: bold;">for</span>? <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">0</span>
Key does not expire at all
Is this correct? <span style="color: #7a0874; font-weight: bold;">&#40;</span>y<span style="color: #000000; font-weight: bold;">/</span>N<span style="color: #7a0874; font-weight: bold;">&#41;</span> y
&nbsp;
You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address <span style="color: #000000; font-weight: bold;">in</span> this form:
    <span style="color: #ff0000;">&quot;Heinrich Heine (Der Dichter) &lt;heinrichh@duesseldorf.de&gt;&quot;</span>
&nbsp;
Real name: Dominic Mitchell
Email address: dom<span style="color: #000000; font-weight: bold;">@</span>happygiraffe.net
Comment:
You selected this USER-ID:
    <span style="color: #ff0000;">&quot;Dominic Mitchell &lt;dom@happygiraffe.net&gt;&quot;</span>
&nbsp;
Change <span style="color: #7a0874; font-weight: bold;">&#40;</span>N<span style="color: #7a0874; font-weight: bold;">&#41;</span>ame, <span style="color: #7a0874; font-weight: bold;">&#40;</span>C<span style="color: #7a0874; font-weight: bold;">&#41;</span>omment, <span style="color: #7a0874; font-weight: bold;">&#40;</span>E<span style="color: #7a0874; font-weight: bold;">&#41;</span>mail or <span style="color: #7a0874; font-weight: bold;">&#40;</span>O<span style="color: #7a0874; font-weight: bold;">&#41;</span>kay<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>Q<span style="color: #7a0874; font-weight: bold;">&#41;</span>uit? O
You need a Passphrase to protect your secret key.
&nbsp;
We need to generate a lot of random bytes. It is a good idea to perform
some other action <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">type</span> on the keyboard, move the mouse, utilize the
disks<span style="color: #7a0874; font-weight: bold;">&#41;</span> during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++.++++++++++.++++++++++.+++++++++++++++.+++++++++++++++.+++++...++++++++++.+++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++<span style="color: #000000; font-weight: bold;">&gt;</span>++++++++++<span style="color: #000000; font-weight: bold;">&gt;</span>+++++......+++++
We need to generate a lot of random bytes. It is a good idea to perform
some other action <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">type</span> on the keyboard, move the mouse, utilize the
disks<span style="color: #7a0874; font-weight: bold;">&#41;</span> during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
..++++++++++++++++++++.++++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++.++++++++++++++++++++++++++++++.+++++++++++++++.+++++...++++++++++.+++++<span style="color: #000000; font-weight: bold;">&gt;</span>.++++++++++<span style="color: #000000; font-weight: bold;">&gt;</span>..+++++<span style="color: #000000; font-weight: bold;">&gt;</span>+++++.......+++++^^^
gpg: <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dom<span style="color: #000000; font-weight: bold;">/</span>.gnupg<span style="color: #000000; font-weight: bold;">/</span>trustdb.gpg: trustdb created
gpg: key A24D5076 marked <span style="color: #c20cb9; font-weight: bold;">as</span> ultimately trusted
public and secret key created and signed.
&nbsp;
gpg: checking the trustdb
gpg: <span style="color: #000000;">3</span> marginal<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> needed, <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">complete</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> needed, PGP trust model
gpg: depth: <span style="color: #000000;">0</span>  valid:   <span style="color: #000000;">1</span>  signed:   <span style="color: #000000;">0</span>  trust: <span style="color: #000000;">0</span>-, 0q, 0n, 0m, 0f, 1u
pub   1024D<span style="color: #000000; font-weight: bold;">/</span>A24D5076 <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">24</span>
      Key fingerprint = 2F2E 85D8 A945 41C2 B7D1  667A <span style="color: #000000;">8616</span> 2CE5 A24D <span style="color: #000000;">5076</span>
uid                  Dominic Mitchell <span style="color: #000000; font-weight: bold;">&lt;</span>dom<span style="color: #000000; font-weight: bold;">@</span>happygiraffe.net<span style="color: #000000; font-weight: bold;">&gt;</span>
sub   2048g<span style="color: #000000; font-weight: bold;">/</span>4C2D8074 <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">24</span></pre></div></div>

<p>As an aside, I am using gnupg 1, as I had some issues with the maven-plugin and gnupg 2.  And it was simpler to just install gnupg 1 than fix the issues. <img src='http://happygiraffe.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>This creates a bunch of files in <code>~/.gnupg</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> ~<span style="color: #000000; font-weight: bold;">/</span>.gnupg
total <span style="color: #000000;">64</span>
<span style="color: #660033;">-rw-------</span>  <span style="color: #000000;">1</span> dom  dom  <span style="color: #000000;">9154</span> <span style="color: #000000;">21</span> Jun <span style="color: #000000;">20</span>:<span style="color: #000000;">39</span> gpg.conf
<span style="color: #660033;">-rw-------</span>  <span style="color: #000000;">1</span> dom  dom  <span style="color: #000000;">1171</span> <span style="color: #000000;">24</span> Jun <span style="color: #000000;">20</span>:<span style="color: #000000;">44</span> pubring.gpg
<span style="color: #660033;">-rw-------</span>  <span style="color: #000000;">1</span> dom  dom  <span style="color: #000000;">1171</span> <span style="color: #000000;">24</span> Jun <span style="color: #000000;">20</span>:<span style="color: #000000;">44</span> pubring.gpg~
<span style="color: #660033;">-rw-------</span>  <span style="color: #000000;">1</span> dom  dom   <span style="color: #000000;">600</span> <span style="color: #000000;">24</span> Jun <span style="color: #000000;">20</span>:<span style="color: #000000;">44</span> random_seed
<span style="color: #660033;">-rw-------</span>  <span style="color: #000000;">1</span> dom  dom  <span style="color: #000000;">1320</span> <span style="color: #000000;">24</span> Jun <span style="color: #000000;">20</span>:<span style="color: #000000;">44</span> secring.gpg
<span style="color: #660033;">-rw-------</span>  <span style="color: #000000;">1</span> dom  dom  <span style="color: #000000;">1280</span> <span style="color: #000000;">24</span> Jun <span style="color: #000000;">20</span>:<span style="color: #000000;">44</span> trustdb.gpg</pre></div></div>

<p>Next, it needs to be published on to one of the key servers.  The default configuration comes set up with a keyserver <a href="http://keys.gnupg.net/">keys.gnupg.net</a>.  You can send your key up there easily:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ gpg <span style="color: #660033;">--send-keys</span> A24D5076
gpg: sending key A24D5076 to hkp server keys.gnupg.net</pre></div></div>

<p>And now it&#8217;s <a href="http://keys.gnupg.net/pks/lookup?search=happygiraffe&#038;op=vindex">published</a>.</p>
<p>Integrating this with your maven build is fairly simple.  The <a href="http://maven.apache.org/plugins/maven-gpg-plugin/usage.html">example configuration</a> works exactly as expected.  I did one thing slightly differently: I created a <em>gpg</em> profile, and then referenced that from the release plugin.  That means I&#8217;ll only sign releases, not all builds.  Which seems reasonable enough to me.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pluginManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-release-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.0-beta-9<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;releaseProfiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>gpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/releaseProfiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pluginManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>gpg<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-gpg-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            …
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/06/24/gnupg-very-basically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Maven Ecosystem</title>
		<link>http://happygiraffe.net/blog/2009/06/18/the-maven-ecosystem/</link>
		<comments>http://happygiraffe.net/blog/2009/06/18/the-maven-ecosystem/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 11:31:14 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javawug]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1541</guid>
		<description><![CDATA[Last night I went to see Jason van Zyl of sonatype talking about various bits of the maven ecosystem, and where they&#8217;re going. The main bit for me was what&#8217;s coming up in maven 3.0. There was a great deal &#8230; <a href="http://happygiraffe.net/blog/2009/06/18/the-maven-ecosystem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last night I went to see <a href="http://twitter.com/jvanzyl">Jason van Zyl</a> of <a href="http://www.sonatype.com/">sonatype</a> talking about various bits of <a href="http://www.jroller.com/javawug/entry/javawug_bof_49_maven_3">the maven ecosystem</a>, and where they&#8217;re going.  The main bit for me was what&#8217;s coming up in maven 3.0.  There was a great deal of talk about <a href="http://www.osgi.org/">OSGI</a> related issues, but it reinforced my belief that whilst there&#8217;s some good technology in there, it&#8217;s still quite complicated to use and manage.  Steps are being taken to address this (better tooling support), but they&#8217;re not there yet.  Also, for the kind of things I do (simple, content-driven, somewhat static webapps), it doesn&#8217;t seem to be necessary anyway.</p>
<p>So what&#8217;s coming up in maven 3.0?  Fundamentally, there won&#8217;t be that many new user-visible features (wait for 3.1!).  Internally, there have been <em>huge</em> refactorings by the sound of things (along with integration tests to ensure no user-visible regressions).  They&#8217;re switching away from <a href="http://plexus.codehaus.org/">plexus</a> and towards <a href="http://code.google.com/p/google-guice/">guice</a> + <a href="http://code.google.com/p/peaberry/">peaberry</a>.  But that&#8217;s internal detail.  And in theory, it shouldn&#8217;t matter even if you&#8217;re a plugin author.</p>
<p>What sounded really nice was the focus on making life much easier for users of the embedded maven.  Primarily, this means IDE authors.  Things like plugin &#038; lifecycle extension points, and incremental build support should allow m2eclipse to be much, much more intelligent about the work they do.  Jason mentioned that a version of m2eclipse which builds on the trunk of maven 3.0 can now build the trunk of maven in seconds rather than minutes.  Why?  Because it&#8217;s not duplicating work that&#8217;s already been done by Eclipse.</p>
<p>The main change is to the artifact resolution system.  It&#8217;s been one of the main source of bugs in maven 2.0.  It&#8217;s been completely junked in 3.0 and replaced with <a href="http://maven.apache.org/mercury/index.html">mercury</a>, which handles both transport and resolving artifacts.  It should be better tested, and things like version ranges much closer to how OSGI does things.</p>
<p>One (minor) change is that the error messages should be much better.  That&#8217;s a welcome relief.</p>
<p>There are other tidbits that I <em>think</em> are scheduled for 3.1 that should be really nice:</p>
<ul>
<li>everybody&#8217;s favourite: versionless parent elements</li>
<li>attributes in the POM — hooray, that should make POMs vastly smaller.</li>
<li>mixin POMs — should allow much more flexibility in constructing dependencies on both groups of artifacts and groups of plugins.</li>
</ul>
<p>There were further talks about <a href="https://hudson.dev.java.net/">hudson</a> &#038; <a href="http://nexus.sonatype.org/">nexus</a>, but I&#8217;m fairly familiar with these, so I didn&#8217;t see much of news to me.</p>
<p>My thanks go to <a href="http://www.jroller.com/peter_pilgrim/">Peter Pilgrim</a> for organising and <a href="http://www.conchango.com/">EMC/Comchango</a> for hosting.<a href="http://www.conchango.com/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/06/18/the-maven-ecosystem/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>dependency complexity</title>
		<link>http://happygiraffe.net/blog/2009/06/01/dependency-complexity/</link>
		<comments>http://happygiraffe.net/blog/2009/06/01/dependency-complexity/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 20:52:04 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1521</guid>
		<description><![CDATA[I love the google-collections library. It&#8217;s got some really nice features. But, it’s not stable yet. They&#8217;ve explicitly stated that until they hit 1.0 it’s not going to be a stable API. So there are changes each release. Nothing major, &#8230; <a href="http://happygiraffe.net/blog/2009/06/01/dependency-complexity/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love the <a href="http://code.google.com/p/google-collections/">google-collections</a> library. It&#8217;s got some <a href="http://happygiraffe.net/blog/2008/07/22/google-collections-to-the-rescue/">really nice features</a>. But, it’s not stable yet. They&#8217;ve explicitly stated that until they hit 1.0 it’s not going to be a stable API. So there are changes each release. Nothing major, but changes.</p>
<p>As an example, in the jump from <a href="http://code.google.com/p/google-collections/wiki/Releases#Release_0.9_(snapshot_20090211)">0.9</a> to <a href="http://code.google.com/p/google-collections/wiki/Releases#Release_1.0_(RC1_-_20090406)">1.0rc1</a>, the static methods on the Join class became the fluent API on the <a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Joiner.html">Joiner</a> class.</p>
<p>(as an aside, could we have some <a href="http://google-collections.googlecode.com/svn/tags/">tags</a>, please?)</p>
<p>Following this change is simple.</p>

<div class="wp_syntax"><div class="code"><pre class="diff" style="font-family:monospace;"><span style="color: #440088;">@@ -310,7 +310,7 @@</span>
         <span style="">&#125;</span> catch <span style="">&#40;</span>KeyStoreException e<span style="">&#41;</span> <span style="">&#123;</span>
             throw new RuntimeException<span style="">&#40;</span>e<span style="">&#41;</span>;
         <span style="">&#125;</span>
<span style="color: #991111;">-        return Join.join<span style="">&#40;</span>&quot; | &quot;, principals<span style="">&#41;</span>;</span>
<span style="color: #00b000;">+        return Joiner.on<span style="">&#40;</span>&quot; | &quot;<span style="">&#41;</span>.join<span style="">&#40;</span>principals<span style="">&#41;</span>;</span>
     <span style="">&#125;</span>
&nbsp;
     /**</pre></div></div>

<p>But the knock-on effect comes when you start getting lots of things which have google-collections dependencies.  At <code>$WORK</code>, I&#8217;ve got a project whose dependencies look like this.</p>
<div style="text-align:center;"><img src="http://happygiraffe.net/blog/wp-content/uploads/2009/06/dc2-deps-before.png" alt="dc2-deps-before.png" border="0" width="264" height="380" /></div>
<p>I wanted to extract a part of DC2 into its own library, <code>commslib</code>.  This was pretty easy as the code was self contained.  Naturally, I wanted it to use the latest version of everything, so I upgraded google-collections to 1.0rc1.  Again, fairly simple.</p>
<p>This is what I ended up with.</p>
<div style="text-align:center;"><img src="http://happygiraffe.net/blog/wp-content/uploads/2009/06/dc2-deps-after.png" alt="dc2-deps-after.png" border="0" width="293" height="380" /></div>
<p>Except that now there&#8217;s a problem.</p>
<ul>
<li>commslib uses <code>Joiner</code>, so it&#8217;ll blow up unless it upgrade <code>DC2</code>&#8216;s google-collections to 1.0rc1.</li>
<li>GSK uses <code>Join</code>, so it&#8217;ll blow up if I upgrade <code>DC2</code>&#8216;s google-collections to 1.0rc1.</li>
</ul>
<p>And thus have I painted myself into a corner.  <img src='http://happygiraffe.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>As it happens, <code>DC2</code> had a <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management">dependencyManagement</a> section forcing everything to use google-collections 0.8.  &rarr; Instant <em>BOOM</em>.</p>
<p>The solution is to upgrade all my dependencies to use google-collections 1.0rc1.  But this turns out to be a much larger change than I had originally envisaged, as now I have to create releases for two dependent projects.  This isn&#8217;t too much of a hassle in this case (yay for the <a href="http://maven.apache.org/plugins/maven-release-plugin/">maven-release-plugin</a>), but it could be a large undertaking if either of those projects is not presently in a releasable state.</p>
<p>I&#8217;m not trying to pick on google-collections (I still love it).  I&#8217;m just marvelling at how quickly complexity can blossom from something so simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/06/01/dependency-complexity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Github Pages with Maven</title>
		<link>http://happygiraffe.net/blog/2009/01/17/github-pages-with-maven/</link>
		<comments>http://happygiraffe.net/blog/2009/01/17/github-pages-with-maven/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 00:44:38 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1454</guid>
		<description><![CDATA[Github recently introduced their pages feature, for serving static content. This sounds like an ideal match for a maven , so I thought I&#8217;d give it a go. I managed to get happygiraffe.github.com/tclogview/ up and running in fairly short order, &#8230; <a href="http://happygiraffe.net/blog/2009/01/17/github-pages-with-maven/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/">Github</a> recently introduced their <a href="http://github.com/blog/272-github-pages">pages</a> feature, for serving static content.  This sounds like an ideal match for a <a href="http://maven.apache.org/plugins/maven-site-plugin/">maven </a>, so I thought I&#8217;d give it a go.  I managed to get <a href="http://happygiraffe.github.com/tclogview/">happygiraffe.github.com/tclogview/</a> up and running in fairly short order, but I&#8217;m not totally happy with the end result.  And that&#8217;s not <em>just</em> the fault of the default maven site.</p>
<p>First things first.  We need to set up the gh-pages branch as devoid of content.  I nicked most of this from drnic&#8217;s <a href="http://maven.apache.org/plugins/maven-site-plugin/">sake-tasks</a>, even though the instructions are also on <a href="http://pages.github.com/">pages.github.com</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> symbolic-ref HEAD refs<span style="color: #000000; font-weight: bold;">/</span>heads<span style="color: #000000; font-weight: bold;">/</span>gh-pages
<span style="color: #c20cb9; font-weight: bold;">rm</span> .git<span style="color: #000000; font-weight: bold;">/</span>index
<span style="color: #c20cb9; font-weight: bold;">git</span> clean <span style="color: #660033;">-fdx</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;h1&gt;Coming soon!&lt;/h1&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span>index.html
<span style="color: #c20cb9; font-weight: bold;">git</span> add index.html
<span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-a</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'Initial page'</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> push origin gh-pages</pre></div></div>

<p>Soon, you should be able to see the &#8220;Coming soon!&#8221; message on <code>you.github.com/yourproj/</code>.</p>
<p>Now that&#8217;s there, we need to set it up so that maven can deploy the site to it.  First, let&#8217;s add the branch as a <a href="http://www.kernel.org/pub/software/scm/git/docs/git-submodule.html">submodule</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">repo</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">git</span> config remote.origin.url<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> submodule add <span style="color: #660033;">-b</span> gh-pages <span style="color: #007800;">$repo</span> site</pre></div></div>

<p>That should create a directory &#8220;site&#8221; which contains the index.html you committed a moment ago.  Now you have to ask Maven to deploy the site there.  Add this to your POM.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;distributionManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;site<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>gh-pages<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #808080; font-style: italic;">&lt;!-- This gets automatically pushed to the gh-pages branch. --&gt;</span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>file:${project.basedir}/site<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/site<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/distributionManagement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now you can say <code>mvn site-deploy</code> and it will fill up the site directory with lots of lovely HTML.  Then you have to commit it (separately, since it&#8217;s a submodule) and push it back to github.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  mvn site-deploy
  <span style="color: #7a0874; font-weight: bold;">&#40;</span>
    <span style="color: #7a0874; font-weight: bold;">cd</span> site
    <span style="color: #c20cb9; font-weight: bold;">git</span> add .
    <span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-a</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'Generate site.'</span>
    <span style="color: #c20cb9; font-weight: bold;">git</span> push origin gh-pages
  <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>And shortly thereafter it shows up on the web site.  Magic.</p>
<p>I like this a lot in principal.  But I have a few issues with it as well.  Mostly, this is down to git submodules being quite a blunt instrument:</p>
<ul>
<li>They don&#8217;t auto-update when there&#8217;s a new commit in the submodule — they point at a fixed commit.  You have to ask for it to be updated.</li>
<li>On top of that, you can&#8217;t point the submodule at a branch.  It&#8217;s always pointing at a specific commit.</li>
<li>The submodule location is recorded in <code>.gitmodules</code>.  The main issue I have with this is I can&#8217;t find a way to say &#8220;my current repository&#8221;.  Why is this a problem?  Well, if somebody forks the codebase (and they will, this is git) then they want their site to point at <em>their</em> gh-pages branch, not mine.</li>
<li>The submodule location is my private push URL, not the public one.  Which is all well and good, but when somebody checks out the project, they&#8217;re going to have an error when they try to check it out.  As I found out when setting up the build in <a href="https://hudson.dev.java.net/">hudson</a>.</li>
<li>When somebody else checks out the repository they have an extra step to go through to fetch the submodule contents (<code>git submodule init  git submodule update</code>).</li>
</ul>
<p>I think that next time I try this, I&#8217;ll skip submodules and just checkout a second copy of the repo in <code>../project-site</code>.</p>
<p>I still think it&#8217;s the right way to go.  Not just for the site, but you can also use github pages to serve up a maven repository in a very similar fashion.  Github and maven do seem to go together rather well.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2009/01/17/github-pages-with-maven/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JSPs in Maven</title>
		<link>http://happygiraffe.net/blog/2008/12/27/jsps-in-maven/</link>
		<comments>http://happygiraffe.net/blog/2008/12/27/jsps-in-maven/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 19:50:26 +0000</pubDate>
		<dc:creator>Dominic Mitchell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://happygiraffe.net/blog/?p=1444</guid>
		<description><![CDATA[Every now &#038; then I need to whip out a quick webapp. Normally, I would prefer to use something like freemarker or velocity. But JSP is standard, and it&#8217;s everywhere. Despite it&#8217;s inability to be secure, it is convenient. And &#8230; <a href="http://happygiraffe.net/blog/2008/12/27/jsps-in-maven/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Every now &#038; then I need to whip out a quick webapp.  Normally, I would prefer to use something like <a href="http://freemarker.sourceforge.net/">freemarker</a> or <a href="http://velocity.apache.org/">velocity</a>.  But JSP is standard, and it&#8217;s everywhere.  Despite it&#8217;s <a href="http://happygiraffe.net/blog/2005/11/26/the-wrong-defaults/">inability to be secure</a>, it <em>is</em> convenient.  And that&#8217;s gotta count for something right?</p>
<p>But, I never quite managed to get everything working.  So whilst looking at <a href="http://github.com/happygiraffe/tclogview">tclogview</a>, I figured it out.  First of all, you have to get the dependencies correct.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javax.servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>servlet-api<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>provided<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javax.servlet.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jsp-api<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>provided<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javax.servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jstl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>runtime<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>So you need to pull in both the servlet API and the JSP API.  They&#8217;re both &#8220;provided&#8221; scope, which means that they have to be available when compiling, but they don&#8217;t need to be packaged as they&#8217;ll be there already.  I&#8217;m not sure why you need the JSP API.  When I was playing with NetBeans, it appeared to be necessary to get bits of the editor working correctly.</p>
<p>You also need to pull in the <a href="http://java.sun.com/products/jsp/jstl/">JSP Standard Tag Library</a>.  It&#8217;s not mandatory, but you won&#8217;t get far without it.  The only trouble is that there are a gazillion different versions on the central repository with no clear clue as to which one should be used.  This version appears to work OK.  Importantly, it contains the taglib descriptors.  Also, we set the scope to &#8220;runtime&#8221; as it&#8217;s not needed at compile time.</p>
<p>This gets you started.  The other thing that you need is a correct <code>web.xml</code>.  Different versions of the deployment descriptor get you different features in your JSP page.  Go figure.  Looking in the <a href="http://jcp.org/en/jsr/detail?id=245">JSP spec</a> right now, I can see §JSP.3.3.2:</p>
<blockquote>
<p>The default mode for JSP pages in a Web Application delivered using a <code>web.xml</code> using the Servlet 2.3 or earlier format is to ignore EL expressions; this provides for backward compatibility.</p>
<p>The default mode for JSP pages in a Web Application delivered using a <code>web.xml</code> using the Servlet 2.4 format is to evaluate EL expressions with the <code>${}</code> syntax. Expressions using the <code>#{}</code> are evaluated starting with JSP 2.1. See Section, &#8220;Backwards Compatibility with JSP 2.0&#8243; for more details on the evaluation of <code>#{}</code> expressions.</p>
</blockquote>
<p>This caught me out for a while as I was trying to use the new syntax and it wasn&#8217;t getting interpolated.  I want to use JSP 2.1, so I reckon it&#8217;s easiest to use servlet 2.5.  That means I need a declaration that looks like this in my <code>web.xml</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-app</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;2.5&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/javaee&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    …
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Why was this a problem?  Because the <a href="http://maven.apache.org/guides/mini/guide-webapp.html">maven-archetype-webapp</a> archetype generates a web.xml that looks like this.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">  <span style="color: #00bbdd;">&lt;!DOCTYPE web-app PUBLIC</span>
<span style="color: #00bbdd;">    &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot;</span>
<span style="color: #00bbdd;">    &quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot; &gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Archetype Created Web Application<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Ooops.  This issue was filed as <a href="http://jira.codehaus.org/browse/ARCHETYPE-106">ARCHETYPE-106</a> over a year ago.  Fixing that would have made my life a <em>lot</em> easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://happygiraffe.net/blog/2008/12/27/jsps-in-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

