Hey Ken,
Just a short note because it's late on Sunday :) Take a look at the
"XMLParser" class provided by Forge. The Node API there is what I would
recommend for this type of use-case. It's still in the works, though.
Let me know what you think,
~Lincoln
On Sun, Apr 3, 2011 at 4:29 PM, Paul Bakker <paul.bakker.nl(a)gmail.com>wrote:
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
_______________________________________________
forge-dev mailing list
forge-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev
--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"