EPIC 2014: Googlezon creates the Evolving Personalized Information Construct Products vs. Solutions
May 03

Scripting Maven with Groovy

Builds, Groovy, Java, Tech Add comments

Imagine Maven talking to Jelly talking to Ant talking to Groovy :)

Jeremy Rayner contributed a nice Groovy Ant task, which we can piggy back on in Maven.

Guillaume Laforge put in the magic to make sure that the Maven POM is injected into the scripting engine, so you can play with $pom:

<project default="groovy" xmlns:ant="jelly:ant">
<goal name="groovy">
<ant:taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="maven.dependency.classpath"/>
println pom.eachPropertyName{ println it }
println pom.name

It would be cool to be able to <ant:groovy script=”….”/>, or to write tags IN Groovy itself.

Of course, with m2 we will be able to write plugins with Groovy (as well as BeanShell and the like).

Brett Porter also talked about his addition to Maven to support CVS/SVN as a Maven repository itself. I personally am fine with using a traditional repository, where the http://….. is a SVN view itself, but I do hear people asking for exactly what Brett has implemented. Kudos Brett for doing this even though you won’t be using it yourself!

2 Responses to “Scripting Maven with Groovy”

  1. Guillaume Laforge Says:

    We can already do

  2. Guillaume Laforge Says:

    We can already do <ant:groovy src=”scriptname.groovy”/>
    (seems that the angle brackets don’t work in comments)

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'ajax'