cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BURGHARD √Čric <>
Subject maven migration, ant and groovy
Date Thu, 24 Nov 2005 12:24:07 GMT

I've just commited a set of tools [1] for maven (plugin, extensions and
archetype) that should ease your migration from ant to maven.

A lot of people here should know groovy, but let me explains (i discover
this language one week ago).

It's all about writing plugins for maven with the groovy language which
allow you to reuse ant tasks in a 'kind-of' java language. The language
itself have full access to java classes, and is bytecoded to
regular .class, making groovy objects undiscernible from java ones.

Using the an xslt task on a fileset is, for example, just a matter of
translating the ant's xml syntax to groovy

def ant = new AntBuilder()

def files = ant.fileScanner {
        fileset(dir: srcDir) {
                include(name: "**/*.xml")

for (src in files) {
        def dst = new File(dstDir,
        ant.xslt(in: src.path, out: dst.path, style: myxsl.path, processor: "trax")

The beautifull thing here is that you can add dependency to whatever
processor you want in your pom.xml (saxon8, xalan). Maven handle all
dependencies transparently , ant's task choose the first processor
available, thus the exactly same code (.class) handle a xslt 1.0 or 2.0
transformation (bye bye jar hell).

I've added 2 extensions to maven :
 * plexus-compiler-groovyc which allow you to compile your .groovy(s)
transparently with the maven-compiler-plugin (during mvn compile)
 * maven-plugin-tools-javalike which can parse (with some
limitations) .groovy (and .java) to generate your plugin's descriptor (mvn

One plugin :
 * maven-groovyc-plugin which add a groovyc:compile goal to compile .groovy
(sometime more flexile than plexus-compiler-groovyc)

And one archetype which ease the starting of new groovy plugin projects :
 * maven-archetype-groovymojo

All that stuff is available on a svn repository [1]. Each component have a
quick install documentation (mvn site).



View raw message