Using maven with MMBase
What is the reason to look out for something else then ant.
We have been using the ant build system to build MMBase for some time now. It has made your lives easier compared to the old build script. Some features that we like(d)
are the automatic download , the incremental building and the flexibility that has made it possible to keep building MMBase from source using a simple command. The MMBase build was getting more and more complex and the Ant scripts are growing . They conditionally compile some classes (oracle/Informnix) only when the required jar's are placed in class path, for RMMCI Ant compiles the generator classes , generates the RMMCI Java files and compiles those with the RMI compiler. For the documentation project Ant file runs various tasks, and in the MMBase 1.6 branch Ant patches the Java files to make them compile under Java 1.4. If that's was not enough we also use ant to create the source and binary distributions. Still Ant does not provide us with all the features we want, for the MMBase website shell scripts generate changelogs and initiate the nightly builds. We have started splitting the MMBase core from the MMBase applications for multiple reasons, one example of such an application is the editwizard we hope that by splitting the editwizard it will be possible to fix bugs in the editwizards and release a new editwizard application without the need to release a new MMBase (editwizards are also the only classes in MMBase that call Xalan directely, other parts of MMBase work with any jaxp implementation). While we already have problems with kepping up-to-date with external resources "where is your servletapi on apache.org located today" we also introduced the applications without a good dependency /installation algorithm. And our jar files don't contain version information making it almost impossible to know what versions of the applications you are running. The current status of the Ant build files (MMBase 1.6 and MMBase 1.7) are not able to build because they can't download the servlet api. The bottom line is that Ant is a tool that helps us build MMBase it's not a strategy or method to solve your problems. If we define solutions to your problems it will be possible to implement it with Ant. To sumarize here is what i think is your problem:
-We need to define a strategy to solve your problems
-We need to define how dependencies should work (probably define a directoy structure)
-We need to find a proper way to use/download/install external libs
-We need to have proper nightly builds/ test results
-We need to be able to spend more time programming and less time hacking ant scripts
In the past week I have been investigating whether maven could be used to solve your problems. Maven is a apache jakarta probject located at http://maven.apache.org/ i'm not sure what it actually is but I have used it to build a developers website for MMBase and tried to create MMBase distributions with maven. One thing I can say is that is worked and that you can see the result on http://maven.mmbase.net/mmbase/ . I am quite happy with the result and it solves some of our problems.
How does it work.
After downloading maven I created a projext.xml file (something like an Ant build.xml)
and started using maven. Maven expects the Java files in the src/java directory so nothing compiled. In the project.xml it was possible to defined that the Java files where located under src but still maven has expectations about where source files and test files should be located. Secondly of course MMBase was not building because some external jar's where missing. This was actually quite easy to solve since maven can handle dependencies. It does that by downloading jar's from a well defined repository using well defined naming conventions, the default remote repository is located at http://www.ibiblio.org/maven/ . so after adding
<dependencies>
<dependency>
<id>servletapi</id>
<version>2.3</version>
</dependency>
<dependency>
<id>log4j</id>
<version>1.2.8</version>
</dependency>
<dependency>
<id>hsqldb</id>
<version>1.7.1</version>
</dependency>
</dependencies
to my MMBase project file maven was able to download
http://www.ibiblio.org/maven/servletapi/jars/servletapi-2.3.jar
http://www.ibiblio.org/maven/log4j/jars/log4j-1.2.8.jar
and
http://www.ibiblio.org/maven/hsqldb/jars/hsqldb-1.7.1.jar
maven supports multiple remote repositories (so an MMBase repository can be made)
Of course now we know were to download those jars it easy to fix the MMBase Ant build file :) but still I was amazed by the ease of use
Next problem:
MMBase uses Java1.4 code and maven by default compiles for Java1.3 compatible
so I had to change some default behaviour of maven.
Maven works with plugins and it contains a lot of plugins (jdiff linkcheck docbook distro webapp etc.etc). Maven is not as flexible as Ant and for moost plugins you just have to hope it will work (It usually does, but most of the time you have to move some MMBase files around)
Thats the reason Maven is a "take it or leave it" application you have to cope with the less pleasant parts.
The final project file can be found at
http://maven.mmbase.net/project.xml file (of course this file has been edited for about week but basically that's the only real configuration maven requires to build the website)
The good:
-minimum input maximum ourput. I really only created a few files and here it is your developers website with stuff like
changelog http://maven.mmbase.net/mmbase/changelog-report.html with direct links to the mmbase repository
checkstyle http://maven.mmbase.net/mmbase/checkstyle-report.html (don't open since it's 24 MB (78264 errors)
developers activity http://maven.mmbase.net/mmbase/developer-activity-report.html
javadocs http://maven.mmbase.net/mmbase/apidocs/index.html
browsable source http://maven.mmbase.net/mmbase/xref/index.html
junit test results http://maven.mmbase.net/mmbase/junit-report.html
PMD reports http://maven.mmbase.net/mmbase/pmd-report.html
docbook http://maven.mmbase.net/mmbase/mmbase-docs.html
The whole site is well integrated.
The bad
-I don't know if it's possible to create something for rmmci
-It's like emacs (eats all you memory and is slow)
-not easy to customize (luckely i'm happy with the result)
did it meat the goals:
-We need to define a strategy to solve your problems
Yes because it defines a way of wokring
-We need to define how dependencies should work (probably define a directoy structure)
yes
-We need to find a proper way to use/download/install external libs
download yes / install and use NO
-We need to have proper nightly builds/ test results
yes
-We need to be able to spend more time programming and less time hacking ant scripts
yes
do we want to use it?
Don't kown
