Apache Maven to substitute ant …

Víctor Fariña Java, Technology

The new tool from Maven takes me a headeache and a few days of configuration and learning about it, but in the end i think its a valuable tool and will be simplify my java developments. You can view my new JDiary home generated enterely with maven at the same time that I generate the JNLP to distribute.

What is Maven:
Maven is a Framework for ant. Its POM (project object model) based and with a couple of files you can build the application, generate test reports, and an entire site for the application.

Overview:

All round about one file : project.xml here we define the name of the application, the jars it depends on, where are the CVS, and more information. see sample at the end of the POST.
The sencond important file is project.properties. It store information about plugins properties for maven (as JNLP, SSH deployment, etc …) again i post my sample file at the end.
The last file is maven.xml (rarely you must modify or create it) but on this case it store ant scripts we need (because maven does not do all ) and goals (on the ant style) to build the application with our own rules.

Sample of starting a new application:

First of all you must download maven
Install it (its very simple)
I recomend use eclipse as you IDE , there are a plugin to eclipse to build maven files.
Then you must start using maven (put it on the PATH) with maven -g or maven genapp, well read
the tutorial here
Some Samples :
With maven jar you complie the sources.
With maven site:generate you generate the entire site to your application.
With maven site:deploy maven will generate a site for your application with download sections, Overview, Documentation, Javadoc, tests , etc … like on my project
JDiary

Problems i found

There are still very little Documentation .

Very little documentation …

Its hard to start ( but i recommend to spend 1 or 2 days on this tool)

Some options I put on my xml files are undocumented and i put them using the intuition (such as maven.jnlp.isapplication = true in JNLP plugin)
On the other side YOU MUST INSTALL cvs to make a cvs -d:pserver:cvs@yourserver:/cvsroot login to initialize the .cvspass on Windows machines. Instead of that you can create a .cvspass on your HOME with a content like this :
/1 :pserver:cvs@CVS_SERVER:2401/usr/local/cvsroot ENCRYPTEDPASSWORD
the encrypted password is obtained with maven changelog:create-cvspass
Errors associated with this issue:
-> Didn ‘t find password for CVSROOT ‘:pserver:user@(protected):/repos ‘.
-> org.netbeans.lib.cvsclient.connection.AuthenticationException: Wrong Password.
and more … only for the CHANGELOG plugin

Sample Files :
Because the tedios labour of pasting XML code on my blog, you must use the CVS repository to see my files.