[forge-dev] Maven plugins configuration

Paul Bakker paul.bakker.nl at gmail.com
Sun Apr 3 16:29:37 EDT 2011


Hi all,

I've been working on some Forge plugins that require adding plugins to the
Maven configuration. For example:

 <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0-beta-3</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>findbugs-maven-plugin</artifactId>
                            <version>2.3.2</version>
                        </plugin>
                    </reportPlugins>
                </configuration>
            </plugin>

It's fairly easy to add a new plugin, all tough the get/set API of Maven is
not great. Adding configuration to a plugin (as in the above example) is
very painful though because you need to parse the XML from a string. We
should have a builder API like the one available for adding dependencies. I
would be happy to work on this, but I want to discuss what's the best way to
approach this. The difficult thing is that anything could be within the
configuration tag.

One option would be to use Groovy for this. Groovy has an excellent XML
builder. Plugin authors could use Groovy directly to create the XML
structure, we should only provide an Adaptor to easily transform the Groovy
node structure to a Maven node structure. On top of that we could provide a
Java API like this:
configuration.addElement("reportPlugins")
   .addElement("plugin")
   .addElement("groupId") etc.

With Groovy it would also be easy to, for example, check if an configuration
element already exists.
If we would use Groovy that means Groovy has to be on the classpath too of
course.

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20110403/822c2e70/attachment.html 


More information about the forge-dev mailing list