mraible wrote:
* @requiresDependencyResolution
That should be the problem: If you add the tag but omit the scope, it
defaults to "runtime". If you want the compile time dependencies, try this:
@requiresDependencyResolution compile
List classpathElements = project.getCompileClasspathElements();
classpathElements.add(project.getBuild().getOutputDirectory());
If you look at the source code [0], you'll notice that the build output is
already included in the compile class path.
classpathElements.add(project.getBuild().getTestOutputDirectory());
That looks odd: You declared your mojo to run the "compile" phase, queried
the compile class path but now add the test classes?
* Returns the an isolated classloader.
[..]
return new URLClassLoader(urls, this.getClass().getClassLoader());
Note that this is not isolated: This class loader will ask the plugin's
class loader first (via the usual parent delegation), i.e. classes from the
plugin class path will hide classes from the project class path.
The reason I'm using provided is
because I don't want the dependencies to end up in my WAR (I'm using
OSGi).
Is it better to use <optional>true</optional> for these dependencies
As far as I can tell, the scope "provided" is the right choice.
Benjamin
[0]
http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?view=markup
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email