I am migrating a legacy Maven build with the GMaven plugin to GMavenPlus and running into the issue that I don't know how I can call external Groovy classes from a local source folder inside my Groovy script.
Here's my previous setup:
<execution>
<id>process-static-content</id>
<goals>
<goal>execute</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<scriptpath>
<element>${pom.basedir}/src/main/some-local-path</element>
</scriptpath>
<source>
// call class from scriptpath that needs access
// to Maven internals
new SomeClassFromTheAboveFolder(project, log).run();
</source>
</configuration>
</execution>
Changing the <source>
to <scripts><script>
is obvious, but as far as I can tell, a <script>
block can only either contain local groovy code or a file path to a script, but neither helps me implement the above usage pattern.
Can anybody provide insight?
So, you're wanting to add additional Groovy sources to GMavenPlus's classpath because those access classes are not part of the Maven project at the point in the lifecycle where GMavenPlus is invoked (e.g. maybe integratation test classes that you need to access during the generate-test-sources phase).
You're correct, there is no mechanism to accomplish this currently (because I simply hadn't considered this scenario). But I'm happy to add it. I've opened #66 to add this functionality.