groovymavengmaven-plugin

Run unbound groovy script in gmaven


According to documentation, it is possible to bind a groovy script to a phase of maven lifecycle, but how do I run it "unbound" ? In other words, I want to do the following thing

Declare my groovy script to use :

<plugin>
    <groupId>org.codehaus.groovy.maven</groupId>
    <artifactId>gmaven-plugin</artifactId>
    <configuration>
        <source>${pom.basedir}/src/main/script/myscript.groovy</source>
    </configuration>
</plugin>

Then invoke it directly from command-line (outside of any lifecycle). But how do I achieve that ?


Solution

  • > mvn org.codehaus.gmaven:gmaven-plugin:execute
    

    note that if you want to select different scripts from the commandline, you have to define different configurations each one in a profile and pick the profile instead.