Maven. It is both fantastic, and stress-inducing. And more than just Maven itself, there is a whole community of Maven plugins which are just as frustrating.
Take the Maven Tomcat Plugin for example. It sounds so nice to just type “mvn tomcat:run” in your webapp module, and have it automagically run, dynamically loading any JSP changes. But, if you have a non-trivial webapp, you probably need to send in some system properties.
Let’s pretend that I require the following command-line parameters passed to Tomcat on the command line:
-Dexample.value.1=alpha -Dexample.value.2=beta
How would I send that in to the Tomcat plugin? Well, the documentation says there is a “systemProperties” element where you can sent them in. But what is the format?
Is the format perhaps like the Surefire Plugin?
<systemProperties>
<property>
<name>example.value.1</name>
<value>alpha</value>
</property>
<property>
<name>example.value.2</name>
<value>beta</value>
</property>
</systemProperties>
Or perhaps the format is like that of the Jetty Plugin?
<systemProperties>
<systemProperty>
<name>example.value.1</name>
<value>alpha</value>
</systemProperty>
<systemProperty>
<name>example.value.2</name>
<value>beta</value>
</systemProperty>
</systemProperties>
Nope. The format is like neither of those. It’s like this:
<systemProperties> <example.value.1>alpha</example.value.1> <example.value.2>beta</example.value.2> </systemProperties>
I’ll admit that this format is a bit less verbose. But why, in the name of all that is holy, does it have to have it’s own 1-off syntax?!? And can you find this documented anywhere else? I was sure challenged finding it.
This is the kind of non-documentation and irregularity that gives Maven a bad name and keeps my blood pressure high.
UPDATE (1 Nov 09): As she says in the comments, Kathy actually took the time to submit a ticket to the Maven Tomcat Plugin maintainers, rather than going with my tactic of passively bitching. And today I get notified by herion that the suggestion was taken and there is now public documentation added about these properties.
I created http://jira.codehaus.org/browse/MTOMCAT-35 in your honor. I feel the same way.
Comment by Kathy — 1 October 2009 @ 12:49
I am trying to do something similar so I feel your pain.
Comparing Tomcat to Jetty, the former has much more solid documentation, but comparing their Maven plugins, Jetty comes ahead in both features and documentation.
Oh, not to mention that tomcat:run executes nicely but accessing pages brings only empty pages. Seems like it requires some special configuration.
Small things do matter…
Comment by herion — 1 November 2009 @ 09:50
Hmm, let me correct my words. Tomcat also has even better documented and implemented Maven plugin. I just couldn’t use their web pages
Lol.
By the way, they seem to have documented your issue:
http://mojo.codehaus.org/tomcat-maven-plugin/examples/add-system-properties.html
Comment by herion — 1 November 2009 @ 12:42
[...] gloves with this review. I’m not very happy with the general quality of Maven documentation (as I’ve noted before), and I wasn’t going to give this book high marks for being just as bad as the [...]
Pingback by Book Review: Apache Maven 2 Effective Implementation « Nelz's Blog — 19 December 2009 @ 15:04