How to evoke Groovy file from Maven POM

259 views Asked by At

I'm using the GMaven plugin to evoke a Groovy script I have defined in my Maven project.

So I have something like:

<plugin>
    <groupId>org.codehaus.gmaven</groupId>
    <artifactId>gmaven-plugin</artifactId>
    <executions>
        <execution>
            <id>Running Unicorn</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>execute</goal>
            </goals>
            <configuration>
                <scriptPath>
                    <path>${project.basedir}/src/main/script</path>
                </scriptPath>
                <source>
                    import Helper
                    new Helper().doSomething()
                </source>
            </configuration>
        </execution>
    </executions>
</plugin>

When it goes to execute the source section of this plugin I get the following error:

[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.5:execute (Running Groovy Execution) on project test-project: startup failed, script1540154364455.groovy: 1: unable to resolve class Helper [ERROR] @ line 1, column 1. [ERROR] 1 error

The path to the script directory is correct, I verified that and the ability to execute Groovy by printing out the path to the Groovy script scriptPath.path.

I'm using the documentation located here but to no avail:

https://groovy.github.io/gmaven/groovy-maven-plugin/scriptpath.html

What am I doing wrong here? Any help or pointers would be appreciated

0

There are 0 answers