<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Unmaintainable &#187; maven</title>
	<atom:link href="http://unmaintainable.wordpress.com/tag/maven/feed/" rel="self" type="application/rss+xml" />
	<link>http://unmaintainable.wordpress.com</link>
	<description>Scripting, Software Engineering and Stuff in Between</description>
	<lastBuildDate>Sun, 22 Nov 2009 09:05:47 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='unmaintainable.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/6f90ae5619dfc90140df401ac60575d2?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Unmaintainable &#187; maven</title>
		<link>http://unmaintainable.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://unmaintainable.wordpress.com/osd.xml" title="Unmaintainable" />
		<item>
		<title>Development Done Right</title>
		<link>http://unmaintainable.wordpress.com/2009/03/01/development-done-right/</link>
		<comments>http://unmaintainable.wordpress.com/2009/03/01/development-done-right/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 09:53:56 +0000</pubDate>
		<dc:creator>mafr</dc:creator>
				<category><![CDATA[best practices]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[opinion]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[rcs]]></category>
		<category><![CDATA[standards]]></category>

		<guid isPermaLink="false">http://unmaintainable.wordpress.com/?p=174</guid>
		<description><![CDATA[In my projects, I&#8217;ve always been the one who took care of infrastructure, standardization and quality assurance from the development perspective. The funny thing is that I&#8217;m no admin and no QA guy, so most of it wasn&#8217;t even my job. In this article, I&#8217;m going to list a few things that in my opinion [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=174&subd=unmaintainable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In my projects, I&#8217;ve always been the one who took care of infrastructure, standardization and quality assurance from the development perspective. The funny thing is that I&#8217;m no admin and no QA guy, so most of it wasn&#8217;t even my job. In this article, I&#8217;m going to list a few things that in my opinion as a software developer are essential to a professional software project.</p>
<p><span id="more-174"></span></p>
<p>What you need is no secret: If you read a few books and follow some technology blogs you know the bits and pieces. I&#8217;ll list a few things from a Java/Maven perspective, so some of this may or may not apply to other platforms.</p>
<p>First of all define a common <strong>coding style</strong>. I shouldn&#8217;t even have to mention this, but there will be chaos and conflict among developers if you don&#8217;t have it. Just use <a href="http://java.sun.com/docs/codeconv/">Sun&#8217;s Code Conventions</a>, make some exceptions like &#8220;maximum line length is 120 characters&#8221; or &#8220;no tabs allowed&#8221; and you&#8217;re halfway done. Provide a bit of example code (one class, one page of paper) and put it up on a wall. This style guide should include rules for things like logging and exception handling strategies as well. Too few developers are even aware that you need a strategy here, so write it down! Don&#8217;t forget to define package namespaces for your project.</p>
<p>For Java projects provide organization-wide <strong>Maven archetypes</strong> that give you a solid basis for your project. Use existing open source ones to get you started! The effort for this pays off with each new project in reduced setup costs. But wait, each of your projects is different? Oh please, then adjust your build scripts. That&#8217;s no excuse to start from zero each time!</p>
<p>On a related note, invest in a proper internal <strong>Maven repository setup</strong>. Maybe use a stripped down version of <a href="http://blogs.atlassian.com/developer/2008/02/maven_in_our_development_proce_2.html">Atlassian&#8217;s setup</a>. You don&#8217;t want your builds to break just because some external repository isn&#8217;t available. Define rules who may deploy what to your repository. I&#8217;ve seen a lot of chaos here, so remind people to actually <em>think</em> before deploying stuff and breaking builds.</p>
<p>Get yourself a proper <strong>bug tracker</strong> and define how you&#8217;re going to use it. It doesn&#8217;t have to be fancy, a <a href="http://trac.edgewall.com">Trac</a> installation will do in most cases and it will give you a wiki for your technical documentation, too. Do you just track issues or also tasks for developers? What&#8217;s the workflow? Who may open a ticket, who may close it? What amount of testing is required?</p>
<p>For god&#8217;s sake, define rules for working with your <strong>revision control system</strong>. How often should developers check in? How should a commit message look? How does your release process look like? When do you create a branch, how are releases tagged etc. Read up on the features of your system, branching may no longer hurt. Move on if you&#8217;re still using CVS.</p>
<p>A professional software project needs <strong>continuous integration</strong>. Period. Set it up (I recommend <a href="https://hudson.dev.java.net/">Hudson</a>), define the proper reports and actually read them. It&#8217;s crucial to check test coverage and other metrics right from the beginning. If you add reports later, you will typically get warnings for every other line of source code. Nobody will read those reports anymore and it&#8217;s too much work to clean up the code.</p>
<p>Provide developers with a proper <strong>workstation setup</strong> that corresponds to the platform you&#8217;re targeting. Yes, it&#8217;s a good idea if everyone on the project used the same JVM and application server versions. If that&#8217;s what your production environment uses, even better! It might improve the chance that things actually <em>work</em>. Just saying.</p>
<p>I&#8217;m barely scratching the surface here, but it&#8217;s enough for one article already. For many of the points above you can find articles on the web (check my blog&#8217;s best practices category, for example). And still, it&#8217;s frustrating how little many software companies invest in those bare essentials.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/unmaintainable.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/unmaintainable.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/unmaintainable.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/unmaintainable.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/unmaintainable.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/unmaintainable.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/unmaintainable.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/unmaintainable.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/unmaintainable.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/unmaintainable.wordpress.com/174/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=174&subd=unmaintainable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://unmaintainable.wordpress.com/2009/03/01/development-done-right/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59c9677a3b9569af44561adab6c2a980?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mafr</media:title>
		</media:content>
	</item>
		<item>
		<title>The State of Java Build Systems</title>
		<link>http://unmaintainable.wordpress.com/2008/08/02/java-build-systems/</link>
		<comments>http://unmaintainable.wordpress.com/2008/08/02/java-build-systems/#comments</comments>
		<pubDate>Sat, 02 Aug 2008 09:29:43 +0000</pubDate>
		<dc:creator>mafr</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[build systems]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[opinion]]></category>

		<guid isPermaLink="false">http://unmaintainable.wordpress.com/?p=76</guid>
		<description><![CDATA[Most people eventually get it that building release artifacts using their IDEs is not the way to nirvana. Builds have to stay stable and reproducible between IDE revisions, and being able to execute them in a command line environment or especially continuous integration servers is key to agile development.
Fortunately, there are open source build tools [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=76&subd=unmaintainable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Most people eventually get it that building release artifacts using their IDEs is <strong>not</strong> the way to nirvana. Builds have to stay stable and reproducible between IDE revisions, and being able to execute them in a command line environment or especially continuous integration servers is key to agile development.</p>
<p>Fortunately, there are open source build tools for Java. Less fortunately, they&#8217;re not quite perfect. Let&#8217;s see what we&#8217;ve got.</p>
<p><span id="more-76"></span></p>
<h4>The Sorry State of Affairs</h4>
<p>There&#8217;s <a href="http://ant.apache.org/">Ant</a>, the undying classic, but pretty much in maintenance mode, I understand. Ant-based build systems usually start small and innocent but quickly turn into a tangled mess. Every Ant script is a unique piece of modern art that has to be deciphered on its own. They are the cockroaches of Java development, and I guess we&#8217;ll have to deal with them again in 30 years when we&#8217;ll be porting ancient Java applications to the next big platform.</p>
<p><a href="http://maven.apache.org/">Maven 2</a> promises relief and introduces convention over configuration, dependency management, lifecycle support and a few other things that aren&#8217;t strictly relevant for a build system. Great concepts, but the actual implementation makes you want to cry. The state of documentation is poor, the XML syntax is unnecessarily bulky, and trivial one-off tasks aren&#8217;t possible without a proper plugin (go and write one if you&#8217;re feeling brave). Not to mention that stunts like multi-module projects are necessary to build a simple EAR file. And no, Eclipse doesn&#8217;t like them either.</p>
<p>Despite all its shortcomings, a lot of people including me tried hard to love Maven, but it&#8217;s not easy.</p>
<h4>The Winds of Change</h4>
<p>Where does that leave us?</p>
<p>I don&#8217;t have much hope for Ant. It is what it is and lacks too many things a build system needs, most importantly built-in conventions and higher level abstractions. Granted, there&#8217;s <a href="http://ant.apache.org/ivy/">Ivy</a>, a pretty nice dependency manager that adds a couple of interesting features, but that&#8217;s about it (Ivy looks heavily inspired by Maven, but it&#8217;s funny how they changed all the terminology).</p>
<p>Maven 2&#8217;s future looks a little bit brighter since it seems the project is opening up to common sense, which maybe be a direct effect of recent discussions and probably Don Brown&#8217;s patches. For example, the XML syntax in 2.1.0 will be much more concise and there are fixed default plugin versions in 2.0.9 so that it&#8217;s easier to have reproducible builds. Unfortunately, the public repository is a swamp of misplaced software and crappy metadata, so there may be no alternative to setting up a local repository.</p>
<p>At the moment, I&#8217;m taking a closer look at <a href="http://incubator.apache.org/buildr/">Buildr</a>, a ruby-based build system for Java that&#8217;s currently under incubation at the <a href="http://apache.org">ASF</a>. Apparently they&#8217;re creating a better Maven, taking the proven concepts but none of its implementation. The jury&#8217;s still out on whether the average coder will be able to create effective, maintainable build scripts, but we&#8217;ll see. Having to learn Ruby may be a problem to some and an incentive to others.</p>
<h4>So?</h4>
<p>Poor build systems and development environments in general are a barrier for new project members and a frequent cause for frustration. I&#8217;ve worked on projects where all you had to do was to check something out from Subversion, type &quot;mvn package&quot; and you were ready to go. For other projects (both commercial and open source!) you needed a specialist&#8217;s support, a couple of days time and a lot of hand-holding to actually build the product and run it locally.</p>
<p>Unfortunately, only few development shops realize that a decent development environment is an asset and invest in their build infrastructure. A good project setup takes time, and if there&#8217;s no time or budget available, your build tool of choice won&#8217;t do any wonders on its own.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/unmaintainable.wordpress.com/76/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/unmaintainable.wordpress.com/76/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/unmaintainable.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/unmaintainable.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/unmaintainable.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/unmaintainable.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/unmaintainable.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/unmaintainable.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/unmaintainable.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/unmaintainable.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/unmaintainable.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/unmaintainable.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=76&subd=unmaintainable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://unmaintainable.wordpress.com/2008/08/02/java-build-systems/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59c9677a3b9569af44561adab6c2a980?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mafr</media:title>
		</media:content>
	</item>
		<item>
		<title>Generating DDL Scripts from JPA Annotations with Maven</title>
		<link>http://unmaintainable.wordpress.com/2008/04/12/hibernate3-schema-creation/</link>
		<comments>http://unmaintainable.wordpress.com/2008/04/12/hibernate3-schema-creation/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 09:48:43 +0000</pubDate>
		<dc:creator>mafr</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[build systems]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://unmaintainable.wordpress.com/?p=51</guid>
		<description><![CDATA[A while ago I posted an article that showed how to generate a database schema from JPA annotations. Since I didn&#8217;t get the hibernate3 maven plugin working back then I used the antrun plugin as a workaround. Thanks to the help of a reader the plugin works now, so an update is in order.

[Update 2009-06-01: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=51&subd=unmaintainable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A while ago I <a href="http://unmaintainable.wordpress.com/2007/06/30/generating-ddl-scripts-with-maven/">posted an article</a> that showed how to generate a database schema from JPA annotations. Since I didn&#8217;t get the <a href="http://mojo.codehaus.org/maven-hibernate3/hibernate3-maven-plugin/">hibernate3 maven plugin</a> working back then I used the <a href="http://maven.apache.org/plugins/maven-antrun-plugin/">antrun plugin</a> as a workaround. Thanks to the help of a reader the plugin works now, so an update is in order.</p>
<p><span id="more-51"></span></p>
<p>[<strong>Update 2009-06-01:</strong> The plugin is now available in version 2.2 from the central maven repository, so I removed the plugin repository configuration. I also switched from annotationconfiguration to jpaconfiguration.]</p>
<p>Since the last article the scenario hasn&#8217;t changed: I want to generate DDL scripts for creating a database schema from JPA annotations. The created schema can then be tweaked as necessary and used in the production environment. Like the old antrun solution, the maven plugin uses the ant task from <a href="http://www.hibernate.org/255.html">Hibernate Tools</a>, so the resulting schema is the same.</p>
<p>This is how it works. Edit your <code>pom.xml</code> and add the plugin configuration:</p>
<pre>
&lt;build&gt;
  &lt;plugins&gt;
    &lt;!-- other plugins ... --&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate3-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.2&lt;/version&gt;
      &lt;executions&gt;
        &lt;execution&gt;
          &lt;phase&gt;process-classes&lt;/phase&gt;
          &lt;goals&gt;
            &lt;goal&gt;hbm2ddl&lt;/goal&gt;
          &lt;/goals&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
      &lt;configuration&gt;
        &lt;components&gt;
          &lt;component&gt;
            &lt;name&gt;hbm2ddl&lt;/name&gt;
            &lt;implementation&gt;jpaconfiguration&lt;/implementation&gt;
          &lt;/component&gt;
        &lt;/components&gt;
        &lt;componentProperties&gt;
          &lt;persistenceunit&gt;Default&lt;/persistenceunit&gt;
          &lt;outputfilename&gt;schema.ddl&lt;/outputfilename&gt;
          &lt;drop&gt;false&lt;/drop&gt;
          &lt;create&gt;true&lt;/create&gt;
          &lt;export&gt;false&lt;/export&gt;
          &lt;format&gt;true&lt;/format&gt;
        &lt;/componentProperties&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
  &lt;plugins&gt;
&lt;/build&gt;
</pre>
<p>Don&#8217;t forget to set the persistence unit to whatever you declared in <code>persistence.xml</code>.</p>
<p>Schema creation is executed in the <code>process-classes</code> phase, so you&#8217;ll find the schema in <code>target/hibernate3/sql/schema.ddl</code> after running <code>mvn package</code> (or any later phase). An alternative is to remove the <code>&lt;executions&gt;</code> element and to run the hbm2ddl goal from the command line:</p>
<pre>
  mvn hibernate3:hbm2ddl
</pre>
<p>The plugin offers a lot more than just schema creation. See the <a href="http://mojo.codehaus.org/maven-hibernate3/hibernate3-maven-plugin/">plugin documentation</a> for more information.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/unmaintainable.wordpress.com/51/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/unmaintainable.wordpress.com/51/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/unmaintainable.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/unmaintainable.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/unmaintainable.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/unmaintainable.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/unmaintainable.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/unmaintainable.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/unmaintainable.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/unmaintainable.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/unmaintainable.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/unmaintainable.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=51&subd=unmaintainable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://unmaintainable.wordpress.com/2008/04/12/hibernate3-schema-creation/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59c9677a3b9569af44561adab6c2a980?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mafr</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Minimal Enterprise Application with Maven</title>
		<link>http://unmaintainable.wordpress.com/2007/07/29/minimal-enterprise-app-maven/</link>
		<comments>http://unmaintainable.wordpress.com/2007/07/29/minimal-enterprise-app-maven/#comments</comments>
		<pubDate>Sun, 29 Jul 2007 07:39:07 +0000</pubDate>
		<dc:creator>mafr</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[build systems]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://unmaintainable.wordpress.com/2007/07/29/minimal-enterprise-app-maven/</guid>
		<description><![CDATA[Setting up a Java EE application is no trivial task. Dependency management, building, and deployment can get pretty complex and require a thorough understanding of deployment descriptors, jars, ears and other artifacts.
In this article, I&#8217;m going to present a truly minimal maven-based setup for the JBoss Application Server (tested with jboss-4.0.5.GA), providing a solid base [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=22&subd=unmaintainable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Setting up a Java EE application is no trivial task. Dependency management, building, and deployment can get pretty complex and require a thorough understanding of deployment descriptors, jars, ears and other artifacts.</p>
<p>In this article, I&#8217;m going to present a truly minimal maven-based setup for the JBoss Application Server (tested with jboss-4.0.5.GA), providing a solid base for further work. The project is an EJB3 demo application which uses JPA to access a database and makes the data available via a remote session bean interface. The application will be deployed in an <code>ear</code> file which contains the required dependencies (unless they are already provided by JBoss).</p>
<p><span id="more-22"></span></p>
<p>First of all, <a href="http://musicbrainz.org/~matt/misc/EnterpriseApp-simple-0.2.tar.gz">download the application</a> and extract it. In the root directory, there&#8217;s a <code>pom.xml</code> file (the POM) which defines the top-level project. Each of the subdirectories (<code>ear</code>, <code>ejb</code>, and <code>client</code>) is a maven project itself with a <code>pom.xml</code> on its own. Apart from some basic values, the top-level POM specifies its <em>sub-modules</em> and gives a list of dependencies for the project. The dependency list is just a declaration, its purpose is to let the other POMs reference dependencies without having to specify the version number.</p>
<p>The <code>ejb</code> module is the heart of the application. It contains the server side source code, which is the data source layer  (DAOs), JPA Entities, and a remote facade (in this case: a stateless session bean). The <code>ejb</code> module creates two jar files: One containing all the code, and the other one with all the interfaces and data transfer objects relevant for remote clients (the <em>client-jar</em>).</p>
<p>The <code>ear</code> module contains no source code, its purpose is to configure the deployment descriptor (<code>application.xml</code>) and to package the <code>ejb</code> module&#8217;s jar file and all the dependencies into a single <code>ear</code> file, ready for deployment into the jboss application server. You&#8217;ll find the created file in <code>ear/target</code>.</p>
<p>The <code>client</code> module implements a simple client application which accesses the server via its remote facade. It can be run from the command line or from within eclipse.</p>
<p>To build the project, run <code>mvn install</code> from the command line. If you want to import the project into eclipse, execute <code>mvn eclipse:eclipse</code> to generate the required <code>.project</code> and <code>.classpath</code> files. From within the IDE, choose <em>File/Import</em>, <em>General/Existing Projects into Workspace</em>, browse to the project&#8217;s base directory and hit <em>Finish</em>.</p>
<p><strong>Update</strong>: I updated the demo application to version 0.2. The new version removes an unused import script that caused confusion and the documentation notes where the JBoss dependencies are coming from.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/unmaintainable.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/unmaintainable.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/unmaintainable.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/unmaintainable.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/unmaintainable.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/unmaintainable.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/unmaintainable.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/unmaintainable.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/unmaintainable.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/unmaintainable.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/unmaintainable.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/unmaintainable.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=22&subd=unmaintainable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://unmaintainable.wordpress.com/2007/07/29/minimal-enterprise-app-maven/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59c9677a3b9569af44561adab6c2a980?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mafr</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Maven Source Plugin</title>
		<link>http://unmaintainable.wordpress.com/2007/07/01/using-the-maven-source-plugin/</link>
		<comments>http://unmaintainable.wordpress.com/2007/07/01/using-the-maven-source-plugin/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 07:57:22 +0000</pubDate>
		<dc:creator>mafr</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[build systems]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://unmaintainable.wordpress.com/2007/07/01/using-the-maven-source-plugin/</guid>
		<description><![CDATA[When using an ordinary jar library, IDEs like Eclipse&#8217;s JDE don&#8217;t have enough information to display inline javadocs for referenced classes. You have to manually direct Eclipse to the library&#8217;s source code to take advantage of inline documentation. Maven&#8217;s source plugin provides a convenient solution to this problem. When building the library, the plugin creates [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=25&subd=unmaintainable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When using an ordinary jar library, IDEs like Eclipse&#8217;s JDE don&#8217;t have enough information to display inline javadocs for referenced classes. You have to manually direct Eclipse to the library&#8217;s source code to take advantage of inline documentation. Maven&#8217;s <a href="http://maven.apache.org/plugins/maven-source-plugin/">source plugin</a> provides a convenient solution to this problem. When building the library, the plugin creates a source jar containing the package&#8217;s source code. This source package can be installed or deployed into your repository. Maven&#8217;s <a href="http://maven.apache.org/plugins/maven-eclipse-plugin/">eclipse plugin</a> then adds the source package to the generated <code>.classpath</code> file.</p>
<p><span id="more-25"></span></p>
<p>This is how it works. Before installing or deploying your library, run the source plugin:</p>
<pre>
  mvn source:jar
</pre>
<p>Your next <code>install</code> or <code>deploy</code> call will take care of the rest. In the dependent project (the one using your library), run the eclipse plugin:</p>
<pre>
  mvn eclipse:eclipse
</pre>
<p>After refreshing the project in eclipse, you should now have access to inline documentation.</p>
<p>If you don&#8217;t want to run <code>source:jar</code> each time, you can attach the call to the build lifecycle&#8217;s <code>package</code> phase:</p>
<pre>
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;jar&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</pre>
<p>After running <code>mvn package</code>, there should be a source package in your <code>target</code> directory.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/unmaintainable.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/unmaintainable.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/unmaintainable.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/unmaintainable.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/unmaintainable.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/unmaintainable.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/unmaintainable.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/unmaintainable.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/unmaintainable.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/unmaintainable.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/unmaintainable.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/unmaintainable.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=25&subd=unmaintainable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://unmaintainable.wordpress.com/2007/07/01/using-the-maven-source-plugin/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59c9677a3b9569af44561adab6c2a980?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mafr</media:title>
		</media:content>
	</item>
		<item>
		<title>Generating DDL Scripts with Maven</title>
		<link>http://unmaintainable.wordpress.com/2007/06/30/generating-ddl-scripts-with-maven/</link>
		<comments>http://unmaintainable.wordpress.com/2007/06/30/generating-ddl-scripts-with-maven/#comments</comments>
		<pubDate>Sat, 30 Jun 2007 08:34:48 +0000</pubDate>
		<dc:creator>mafr</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[build systems]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://unmaintainable.wordpress.com/2007/06/30/generating-ddl-scripts-with-maven/</guid>
		<description><![CDATA[Java&#8217;s persistence API (JPA) makes object-relational mapping very convenient. Using Hibernate, tables and sequences are generated automatically which speeds up development significantly. However, in production systems automatic schema creation isn&#8217;t desired. In many cases you would want to tune the schema a bit, like adding an index for speeding up common access paths, renaming constraints [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=24&subd=unmaintainable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Java&#8217;s persistence API (JPA) makes object-relational mapping very convenient. Using <a href="http://hibernate.org">Hibernate</a>, tables and sequences are generated automatically which speeds up development significantly. However, in production systems automatic schema creation isn&#8217;t desired. In many cases you would want to tune the schema a bit, like adding an index for speeding up common access paths, renaming constraints and the like. Additionally, an application should run with as little DB privileges as possible, so it is possible that <code>CREATE TABLE</code> is simply not permitted.</p>
<p><span id="more-24"></span></p>
<p><strong>[UPDATE: See <a href="http://unmaintainable.wordpress.com/2008/04/12/hibernate3-schema-creation/">this article</a> for a pure maven solution.</a>]</strong></p>
<p>The usual approach is to create a DDL script containing the required <code>CREATE</code> commands and execute it on the database before deploying the application. Unfortunately, this is a large task if you have many entities and with foreign key constraints, the order of commands matters. So it would be nice if we could generate a working DDL script from our JPA annotations that can be adjusted manually.</p>
<p>Using Hibernate and the <code>hibernatetool</code> <a href="http://ant.apache.org">Ant</a> task, this is possible. In the following example, I&#8217;ll show how to configure a <a href="http://maven.apache.org">Maven</a> project which used the <a href="http://maven.apache.org/plugins/maven-antrun-plugin/">antrun</a> plugin to execute hibernatetool from within Maven.</p>
<p>First of all, we have to attach the antrun plugin to Maven&#8217;s lifecycle. Add the following to your <code>pom.xml</code>:</p>
<pre>
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;process-classes&lt;/id&gt;
            &lt;phase&gt;process-classes&lt;/phase&gt;
            &lt;configuration&gt;
              &lt;tasks&gt;
                &lt;ant antfile="src/main/ant/build.xml" inheritRefs="true"&gt;
                  &lt;target name="schemaexport"/&gt;
                &lt;/ant&gt;
              &lt;/tasks&gt;
            &lt;/configuration&gt;
            &lt;goals&gt;
              &lt;goal&gt;run&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
        &lt;dependencies&gt;
          &lt;dependency&gt;
            &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
            &lt;artifactId&gt;hibernate-tools&lt;/artifactId&gt;
            &lt;version&gt;3.2.0.beta9a&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
            &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
            &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
            &lt;version&gt;3.2.1.ga&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
            &lt;groupId&gt;log4j&lt;/groupId&gt;
            &lt;artifactId&gt;log4j&lt;/artifactId&gt;
            &lt;version&gt;1.2.14&lt;/version&gt;
          &lt;/dependency&gt;
        &lt;/dependencies&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</pre>
<p>The plugin configuration references an external <code>build.xml</code> file which contains the hibernatetool invocations. Create a directory <code>src/main/ant</code> and add the following <code>build.xml</code> file:</p>
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;project&gt;

    &lt;!--
          Generate DDL files for schema creation.
    --&gt;
    &lt;target name="schemaexport"&gt;

        &lt;taskdef name="hibernatetool"
                 classname="org.hibernate.tool.ant.HibernateToolTask"/&gt;

        &lt;hibernatetool destdir="target"&gt;

            &lt;classpath refid="maven.compile.classpath"/&gt;

            &lt;!-- Use JPA annotations, as opposed to Hibernate's hbm
                 files. If there are multiple persistence units, specify
                 the correct one using the  "persistenceunit" attribute.
            --&gt;
            &lt;jpaconfiguration /&gt;

            &lt;!-- Write all CREATE statements to a file. --&gt;
            &lt;hbm2ddl drop="false" create="true" export="false"
                     outputfilename="schema-create.ddl"
                     delimiter=";" format="true"/&gt;

            &lt;!-- Write all DROP statements to a different file. --&gt;
            &lt;hbm2ddl drop="true" create="false" export="false"
                     outputfilename="schema-drop.ddl"
                     delimiter=";" format="true"/&gt;

        &lt;/hibernatetool&gt;

    &lt;/target&gt;

&lt;/project&gt;
</pre>
<p>Now you can run <code>mvn generate-classes</code> and you will find two DDL files in the <code>target</code> directory: One for creating and one for dropping all tables.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/unmaintainable.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/unmaintainable.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/unmaintainable.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/unmaintainable.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/unmaintainable.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/unmaintainable.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/unmaintainable.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/unmaintainable.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/unmaintainable.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/unmaintainable.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/unmaintainable.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/unmaintainable.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=24&subd=unmaintainable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://unmaintainable.wordpress.com/2007/06/30/generating-ddl-scripts-with-maven/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59c9677a3b9569af44561adab6c2a980?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mafr</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick Java Project Setup Using Maven</title>
		<link>http://unmaintainable.wordpress.com/2007/03/04/java-project-setup-using-maven/</link>
		<comments>http://unmaintainable.wordpress.com/2007/03/04/java-project-setup-using-maven/#comments</comments>
		<pubDate>Sun, 04 Mar 2007 10:16:27 +0000</pubDate>
		<dc:creator>mafr</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[build systems]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://unmaintainable.wordpress.com/2007/03/04/java-project-setup-using-maven/</guid>
		<description><![CDATA[Java projects, especially when it comes to web or EJB applications, tend to get pretty complex. Setting up such a project is a non-trivial task because of the many conventions you have to follow to make your application deployable. The maven project management tool provides a mechanism to setup a project quickly using its archetype [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=15&subd=unmaintainable&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Java projects, especially when it comes to web or EJB applications, tend to get pretty complex. Setting up such a project is a non-trivial task because of the many conventions you have to follow to make your application deployable. The <a href="http://maven.apache.org">maven</a> project management tool provides a mechanism to setup a project quickly using its <em>archetype concept</em>.</p>
<p><span id="more-15"></span></p>
<p>An archetype is a template which creates a skeleton project for you that already knows which dependencies to download and how to build a deployable package. All you have to do is to adjust the maven configuration file (<code>pom.xml</code>) to your needs and fill in code.</p>
<p>When I wanted to play with Seam, all I had to do was to locate a proper archetype and run the following command (all on one line):</p>
<pre>
mvn archetype:create
  -DarchetypeGroupId=org.apache.maven.archetypes
  -DarchetypeArtifactId=softeu-archetype-seam-simple
  -DgroupId=de.mafr.seam
  -DartifactId=Seam-Demo
  -DremoteRepositories=http://maven.softeu.cz
</pre>
<p>A directory <code>Seam-Demo</code> is created which contains a skeleton project. You can create a deployable WAR-File from it using <code>mvn package</code>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/unmaintainable.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/unmaintainable.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/unmaintainable.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/unmaintainable.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/unmaintainable.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/unmaintainable.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/unmaintainable.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/unmaintainable.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/unmaintainable.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/unmaintainable.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/unmaintainable.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/unmaintainable.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=unmaintainable.wordpress.com&blog=586265&post=15&subd=unmaintainable&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://unmaintainable.wordpress.com/2007/03/04/java-project-setup-using-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/59c9677a3b9569af44561adab6c2a980?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mafr</media:title>
		</media:content>
	</item>
	</channel>
</rss>