mavengroovygmavenplus

groovy-maven-plugin: How to add a dependency for executing groovy scripts?


I want to execute a small groovy script via the groovy-maven-plugin(or gmavenplus) during build, I need a third-party dependency, but the project itself doesn't need this dependency, how to add this dependency only for executing groovy scriptes?


Solution

  • Add the needed library as a plugin dependency.

    <plugin>
        <artifactId>groovy-maven-plugin</artifactId>
        ...
        <dependencies>
            <dependency>
                ....
            </dependency>
        </dependencies>
    </plugin>