<?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>MuddyHorse Farm and Tech &#187; java-build-systems</title>
	<atom:link href="http://blog.muddyhorse.com/tag/java-build-systems/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.muddyhorse.com</link>
	<description>Where animals and technology collide</description>
	<lastBuildDate>Thu, 09 Dec 2010 22:54:54 +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="next" href="http://blog.muddyhorse.com/tag/java-build-systems/feed/?page=2" />

		<item>
		<title>Quick Maven Primer for Java Development</title>
		<link>http://blog.muddyhorse.com/2010/10/quick-maven-primer-for-java-development/</link>
		<comments>http://blog.muddyhorse.com/2010/10/quick-maven-primer-for-java-development/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 18:28:38 +0000</pubDate>
		<dc:creator>pforhan</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[basics]]></category>
		<category><![CDATA[java-build-systems]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[netrexx]]></category>
		<category><![CDATA[rexx]]></category>

		<guid isPermaLink="false">http://blog.muddyhorse.com/?p=381</guid>
		<description><![CDATA[I wrote this up for the NetRexx mailing list, but it&#8217;s a good basics article for anyone wanting to get a quick glance at Maven&#8216;s operations.  I&#8217;m not , I&#8217;m just giving a quick description. Maven 102: Advanced Basics Alternate title:  What you need to do to be a good Maven citizen Java module layout [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this up for the <a href="http://www.google.com/search?q=netrexx&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a">NetRexx</a> <a href="http://www-01.ibm.com/software/awdtools/netrexx/mailinglist.html">mailing list</a>, but it&#8217;s a good basics article for anyone wanting to get a quick glance at <a href="http://maven.apache.org/">Maven</a>&#8216;s operations.  I&#8217;m not <a href="http://blog.muddyhorse.com/2009/02/java-build-systems-part-2-maven/">trying to come up with a better Maven</a>, I&#8217;m just giving a quick description.<span id="more-381"></span></p>
<h2>Maven 102: Advanced Basics</h2>
<p>Alternate title:  What you need to do to be a good Maven citizen</p>
<h3>Java module layout</h3>
<p>Here is the default layout for a java/jar maven module.  You can reconfigure source and output directories, but you may not want to, as I&#8217;ll discuss in a second.</p>
<p>source/input directories:</p>
<pre style="padding-left: 30px;">src/main/java
src/main/resources
src/test/java
src/test/resources</pre>
<p>output directories:</p>
<pre style="padding-left: 30px;">target
target/classes
target/test-classes</pre>
<h3>Build Flow</h3>
<p>A general flow for Maven in such a project would be to:</p>
<ol>
<li>compile src/main/java to target/classes</li>
<li>copy src/main/resources to target/classes</li>
<li>compile src/test/java to target/test-classes</li>
<li>copy src/test/resources to target/test-classes</li>
<li>run unit tests, output to target/surefire-reports</li>
<li>build jar, source jar, and test jars, place in target</li>
</ol>
<p>Again, you can change much of this, but with Maven, the more you fight with it, the more you will have to fight with it.  It kind of snowballs and will cause annoyances down the line, during releases and documentation and site generation and such.</p>
<h3>Repositories</h3>
<p>It is not terrible to set up a repository, but the holy grail (for the users, anyway) is to get your libraries uploaded to <a href="http://repo1.maven.org/maven2/">Maven Central</a> &#8212; this will make the process quite seamless for adding a new compiler to a project because access to Maven Central is basically required for Maven operation.</p>
<h3>Custom Language Compilation</h3>
<p>Another important task for easy maven integration is compilation.  This will generally require a special maven plugin that can essentially execute  the custom language compiler and conform to something similar to the input and output directories above.  This is not too tricky, especially if there is a java entry point to do the work.</p>
<h3>Modularity</h3>
<p>Related to this is a topic of modularity:  how do you break up a project?  How do you resolve circular references across multiple langugaes? For example, you will generally get yourself into trouble if you have:</p>
<pre style="padding-left: 30px;">src/main/java
src/main/netrexx
src/main/javafx</pre>
<p>all in the same module, and are trying to compile them all at once.  Unless you have a single compiler that can process all your source at once, this won&#8217;t work.  You will be far happier to make multiple modules, use maven to describe the dependencies, and do one language at a time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.muddyhorse.com/2010/10/quick-maven-primer-for-java-development/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Java Build Systems, Part 2: Maven</title>
		<link>http://blog.muddyhorse.com/2009/02/java-build-systems-part-2-maven/</link>
		<comments>http://blog.muddyhorse.com/2009/02/java-build-systems-part-2-maven/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 20:39:21 +0000</pubDate>
		<dc:creator>pforhan</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[java-build-systems]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://blog.muddyhorse.com/?p=165</guid>
		<description><![CDATA[Continuing the Java build systems discussion, today I want to focus on Maven, what it does well and what it does that frustrates.  We&#8217;ll get a little taste of the minimum expectations for a new build system as well.  Note:  this page may be subject to edits, as I come across more pros &#38; cons [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing the <a href="http://blog.muddyhorse.com/?tag=java-build-systems">Java build systems discussion</a>, today I want to focus on Maven, what it does well and what it does that frustrates.  We&#8217;ll get a little taste of the minimum expectations for a new build system as well.  Note:  this page may be subject to edits, as I come across more pros &amp; cons of Maven.</p>
<p><span id="more-165"></span><strong>What Maven does right</strong></p>
<p>Maven teaches us several important things about what we need from a build system.</p>
<ul>
<li><em>Convention over configuration. </em> Maven strongly encourages developers to put source files, resources, tests, and project metadata in standard locations.  Maven make life very difficult for anyone deviating from the norms.  In general, this is good, helps teamwork and collaboration, and helps for picking up a project cold.</li>
<li><em>Defaults just work.</em> Similar to the last entry, if you follow maven standards, then it works fine and has a reasonable assumption of defaults.</li>
<li><em>Dependency Management.</em> Probably the single best feature of Maven and modern build tools.  This allows a developer to specify requirements for a project without having to directly specify the physical location of those library dependencies.  This frees the build system to resolve from the network, automatically check for updates, and manage multiple versions of libraries.</li>
<li><em>Plugins</em>.  Easy extensibility is key to Maven.  In fact, most of its internals actually exist as plugins, from compilation to Ant support to deployment.  The ability to add new, custom behavior and have it tie into your builds is fantastic.</li>
</ul>
<p><strong>What Maven does wrong</strong></p>
<p>There are some pretty big gotchas in Maven.  Nothing insurmountable, but frustrating nonetheless.  And before you say &#8220;It&#8217;s open source, fix it yourself!&#8221; know that it is not that simple.  There may be resistance to a certain change, for example, from &#8220;the establishment&#8221; or some issues and Maven&#8217;s solutions are fundamentally tricky.</p>
<ul>
<li><em>Outside the ordinary is very hard.</em> Doing anything beyond the standard use cases requires an arcane knowledge of plugins.  All of a sudden, Maven&#8217;s configuration-based approach falls down, and things become easier to do in code &#8212; ie, you have to write a plugin.  But don&#8217;t think you can use the nifty <a href="http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html">ant-scripted mojos</a> for that plugin&#8211; for example, for compilation, there isn&#8217;t a standard way to get the classpath into the ant script.</li>
<li><em>Dependency Management.</em> Yep, the same benefit is a detriment.  Or, at the very least, Maven&#8217;s handling of it.  Several things fall in here.  The ones I can recall are:
<ul>
<li>Transitive dependencies prove very tricky and make for lots of classloading troubles.  Adding a single dependency to a POM can really change the entire dependency graph of  a project.</li>
<li>There is no way to simply say &#8220;I want the latest of library XX&#8221;.  On the one hand, Maven makes sense here; you should usually know exactly which version of software you are building against.  But there are cases, for example, due to a lack of maturity, where having to know that version number is just an annoyance.  Ivy apparently has an intermediate option here, where you can specify latest, but when a build happens, it records what that version was.</li>
</ul>
</li>
<li><em>Long-standing bugs.</em> Maven suffers a bit from what other mature open-source products hit upon.  Whether it is loss of momentum for something that works well enough or that too many are depending on the quirks, there are lots of oddities and issues left in core plugins.  A perfect example is maven-antrun-plugin, which only sets its classpath once per maven run, regardless of how many POMs reference it.</li>
<li><em>Documentation bugs.</em> Some of the Maven docs are a bit light on details.  Part of it may be Maven&#8217;s built-in site creation, which leads to some sites that have lots of links but are pretty information-sparse.  Other times, many common scenarios are presented, but some of the edge cases are glossed over.  Related:  looking for a list of available Maven properties for use in your POM is tricky because of Maven&#8217;s dynamic nature.  But a simple guide describing common ones and how to construct others would be great.</li>
</ul>
<p><strong>Summary</strong></p>
<p>Generally, what Maven teaches us is that you need to fully embrace Maven to get the full benefit of Maven.  Once you get the hang of the Maven way, things go much more smoothly.  That is not unexpected, but it is uncomfortable.  But there are times where you have to fight &#8212; deploying to multiple load-balanced servers, for example, and you end up with some nasty scripts and configuration on top of a previously elegant solution.</p>
<p>The important thing is, though, that Maven does work.  It&#8217;s not too much of a bear to get started with, has great defaults, and it has some compelling solutions to annoying problems.</p>
<p>So, can Maven be fixed?  Should it be fixed, or should a build system start from scratch?  More on that next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.muddyhorse.com/2009/02/java-build-systems-part-2-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Build Systems, Part 1: What they do</title>
		<link>http://blog.muddyhorse.com/2009/02/java-build-systems-part-1-what-they-do/</link>
		<comments>http://blog.muddyhorse.com/2009/02/java-build-systems-part-1-what-they-do/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 22:10:08 +0000</pubDate>
		<dc:creator>pforhan</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[java-build-systems]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://blog.muddyhorse.com/?p=159</guid>
		<description><![CDATA[Two recent posts on the java-weblog circuit spurred me to motion: Maven Adoption Curve (Alex Miller, coworker at MetaMatrix) Maven and Ivy (Ryan Senior, coworker at BJC) I was trying to think of the ideal build system.  I won&#8217;t pretend that I&#8217;m going to get there in this post.  Instead, I&#8217;ll enumerate what we do [...]]]></description>
			<content:encoded><![CDATA[<p>Two recent posts on the java-weblog circuit spurred me to motion:</p>
<p><a href="http://tech.puredanger.com/2009/01/28/maven-adoption-curve/">Maven Adoption Curve</a> (Alex Miller, coworker at MetaMatrix)<a href="http://www.objectcommando.com/blog/?p=12"><br />
Maven and Ivy</a> (Ryan Senior, coworker at BJC)</p>
<p>I was trying to think of the ideal build system.  I won&#8217;t pretend that I&#8217;m going to get there in this post.  Instead, I&#8217;ll enumerate what we do every day and what we need from a build system so as to start thinking about the ideal system.</p>
<p><span id="more-159"></span>So, to the brainstorming.  Here&#8217;s what we do in the regular process of our osgi bundle development:</p>
<ol>
<li>Obtain dependencies</li>
<li>Compile java source</li>
<li>Compile javafx source</li>
<li>Generate metadata / configuration data</li>
<li>Make jar files</li>
<li>Upload jar files to central repository</li>
<li>Upload jar files to deployment location</li>
<li>Update remote (OBR) xml file with information about uploaded jar</li>
<li>Generate reports about the quality of the source (clover, PMD, checkstyle, etc)</li>
<li>check out from CVS / source control</li>
<li>check in to CVS / source control</li>
<li>tag CVS / source control</li>
<li>manage versions and releases</li>
</ol>
<p>I&#8217;m sure there are more.  Obviously, under web development, you&#8217;d deal with wars and their deployment.  We have ssh tasks to run code on the server.  We even have some install/run stuff that works pretty well.</p>
<p>You may have guessed we use maven.  Maven is so close, but just not there.  It is frustrating, performs a lot of magic, and just falls down in annoying ways.  We have gotten it to do all of the above, some of it is just not pretty.</p>
<p>Next episode, I&#8217;ll go into Maven and what it does well and what it does poorly.  Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.muddyhorse.com/2009/02/java-build-systems-part-1-what-they-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

