Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Friday, May 21, 2004

Moving Away from Maven

I've gotten some comments asking why I'm moving away from Maven.

I started to use Maven initially as part of the HiveMind experiment. Fundamentally, I liked two specific features:

Maven does those two things pretty well, though the documentation part has a large number of bugs that makes keeping the documentation up-to-date problematic.

Anyway, measured by my Four Principals, Maven falls shorts:

  • Simplicity - this isn't even on the horizon in Maven-land. If you deviate even a tiny bit from Maven's one-true-path, you are lost! The complexity of plugins, class-loaders, XML documents that are Jelly programs in disguise, lack of documentation, etc., etc. means that doing something trivial can take hours of guesswork. Some parts of this "release candidate" have obviously not even been given a cursory test. Certainly the internals of most plugins are a maze of Ant, Jelly, properties and such, seemingly without end.

    This could be somewhat addressed by documentation, but there is a pitiful amount and what there is, is out of date. Understanding multi-project (the whole point of Maven you would think) is a total challenge, addressed only by endless experimentation.

  • Consistency - I guess this is hard to guage; do you write your own plugin? Write ad-hoc Jelly script? Write and use an Ant task?
  • Efficiency - Maven is sluggish, chews memory, tends to repeat operations needlessly. I could comment on the volume of downloads that occur (for plugins, for libraries the plugins depend on) but that actually isn't an issue, after you run Maven the first time. However, for HiveMind, I've taken to leaving the room while I perform my dist build ... and it's only two small projects.

    One concrete example: when using Maven, I could only get my unit tests to work by turning fork on. With Ant, I'm able to run the unit tests without forking. That's a huge difference.

  • Feedback - Can you say "NullPointerException"?

What I've accomplished in two days using Ant 1.6 will serve me well for HiveMind and for Tapestry ... and beyond. I think we'll be able to get a significant amount of Maven's functionality in a small, finite, understandable package, and be able to use it on the vast majority of pure Java projects.

For example, Here's the build.xml for the framework:

<project name="HiveMind Framework" default="jar">

	<property name="jar.name" value="hivemind"/>
	<property name="javadoc.package" value="org.apache.hivemind.*"/>

	<property name="root.dir" value=".."/>
	<import file="${root.dir}/common/jar-module.xml"/>
	<import file="${common.dir}/javacc.xml"/>								
					
	<target name="compile">
		<ibiblio-dependency jar="commons-logging-1.0.3.jar" group-id="commons-logging"/>
		<ibiblio-dependency jar="javassist-2.6.jar" group-id="jboss"/>
		<ibiblio-dependency jar="werkz-1.0-beta-10.jar" group-id="werkz"/>
		<ibiblio-dependency jar="servletapi-2.3.jar" group-id="servletapi"/>				
		<ibiblio-dependency jar="oro-2.0.6.jar" group-id="oro"/>
		<ibiblio-dependency jar="log4j-1.2.7.jar" group-id="log4j"/>
				
		<ibiblio-dependency jar="easymock-1.1.jar" group-id="easymock" use="test"/>
			
		<run-javacc input="${javacc.src.dir}/SimpleDataLanguage.jj" package-path="org/apache/hivemind/sdl/parser"/>
		
		<default-compile/>
	</target>

</project>

And here's the the project.xml, project.properties, and maven.xml.

I hate to bash the Maven project ... but what I see in Maven is a good, simple, core idea that's spiralled down the wrong path by trying to be everything to everyone. That's a lesson I'm taking to heart as I build something that suits my needs better.

7 comments:

Brett Porter said...

Nice post Howard, although I think the Ant example is missing some things :)

I've rattled off a longer than intended response here: http://blogs.codehaus.org/people/brett/archives/000731_re_moving_away_from_maven.html

I hope you get a chance to read it and comment.

Unknown said...

ibiblio-dependency is part of "HiveBuild" a collection of Ant 1.6.2 build files used by HiveMind and Tapestry (3.1) to build source. It's flexible and general purpose, but not documented.

Unknown said...

I really, really, really tried hard to like Maven. I don't. It gets in my way, and is unpredictable from release to release. It was hindering my progress, more so than the effort of creating my own Ant scripts. Is Ant perfect? Far from it. But, for me at least, Maven is simply a worse option.

A truly object-oriented solution, where the "build files" or "description files" are, in objects (perhaps Groovy scripts or classes) would be wonderful. But I'm going to let someone else fight that battle.

The HiveBuild stuff is sufficient for building HiveMind and for building Tapestry and I'm not saying the world should run on it. Again, I can only fight so many fires.

Unknown said...

Strange that this comment still gets a lot of views. Ant 1.6.2 has an option to fork once for an entire test suite ... I use that option.

In terms of statics though ... I almost never use those. What do you put in statics? Singletons. What is HiveMind for? Managing singletons. Use of HiveMind (or any other DI container) gets you away from suspect practices like relying on statics.

Anonymous said...

Odd, I've been using Maven for about a year now and I'm not finding it difficult to use or poorly performing, outside of the unit tests, which needs fixed.

It can easily handle an EAR project with a web project, EJBs, a myriad of dependencies and MANIFEST modifications for classpath entries...

Did you read the documentation at all?

Unknown said...

On Maven 2: I absolutely use it now every single day, at at least 90% of the time I like it. My only caveat is that for some things that I know how to do in Ant or Maven 1, I can't quite figure out how to do in Maven 2 ... there's a position where you go from using Maven 2 as a tool to appeasing it like a petty god. :-) But I do all my new work in Maven 2 without hesitation.

Toby said...

A good start would be a "hello-world" quickstart project for the Tapestry5 homepage...a ZIP file that includes everything you need. Without maven, nobody can try out Tapestry at present.