You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Bertram, Alexander" <al...@bedatadriven.com> on 2013/01/11 10:00:34 UTC

Plugins and project classpath

Hi there,
I'm working on the maven plugin for Renjin (R on the JVM) and had a
question about best practices for plugin goals that require project
dependencies.

The renjin-maven-plugin has a compile-namespace goal and a test goal, which
both evaluate R scripts in src/main/R, and so require that the project's
dependencies be included on the classpath.

I've written it now [1] so that the plugin creates a new ClassLoader with
the necessary dependencies. This is a bit awkward however -- as far as I
can tell this means I have to use reflection to communicate between the
Mojo and the evaluator, and then only using types loaded by the system
class loader (and so common to both classloaders). I'm not sure how to
properly do logging, for example.

It also exhausts the permgen space, which you can of course fix with a
MAVEN_OPTS flag, but it will be an extra annoyance to users.

What's the best way to go about this? Should I create a new JVM like
surefire does? Am I just implementing the classloader strategy poorly? Is
there another way to signal to maven that my plugin needs project
dependencies?


Thanks!
Alex


[1]
https://github.com/bedatadriven/renjin/blob/refactor-packages/tools/maven-plugin/src/main/java/org/renjin/maven/NamespaceMojo.java