You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jake Pezaro <Ja...@vcint.com> on 2006/02/16 15:01:34 UTC

inheriting & generating classpath inside plugins

i have written a new plugin.  however, no matter what dependencies are
defined by the calling pom, my pluging has only 2 jars on it's
classpath.  they are:

when running maven from the command line:
.../maven-2.0.2/core/boot/classworlds-1.1.jar

when running maven from eclipse:
.../eclipse/configuration/org.eclipse.osgi/bundles/347/1/.cp/lib/maven-e
mbedder-2.0.2-dep.jar
.../eclipse/configuration/org.eclipse.osgi/bundles/347/1/.cp/m2plugin.ja
r

i need to do know how to do the following two things, but i cannot find
any guidelines on how to do them.

1.  inherit the classpath/dependencies from the calling pom, without
having to explicity re-state them in under
build.plugins.plugin.depedencies
2.  add some additional dependencies to the classpath within the plugin.
these dependencies are all jars located in a directory.

thanks

jake



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Re: inheriting & generating classpath inside plugins

Posted by andrew <li...@pyroboy.com.au>.
Hi Jake,

Have a look at the following:

How Maven's classloaders work
<http://maven.apache.org/guides/mini/guide-maven-classloading.html>

"... each plugin has its own classloader, including its dependencies,
itself, and the libraries above. It *does not* contain the project
dependencies as in Maven 1.x, but instead has access to a list of JAR
files in case they are needed."

The plugin's classpath only contains the plugin's dependencies, not the
calling project's.

In your plugin you need to obtain the project's dependency set and,
using this, create a new classloader.

There is a thread entitled "Project dependencies and plugin
classloaders" around 14/12/05 in the user list archives that gives an
example of the above.

Cheers,
...andrew

Jake Pezaro wrote:
> i have written a new plugin.  however, no matter what dependencies are
> defined by the calling pom, my pluging has only 2 jars on it's
> classpath.  they are:
> 
> when running maven from the command line:
> .../maven-2.0.2/core/boot/classworlds-1.1.jar
> 
> when running maven from eclipse:
> .../eclipse/configuration/org.eclipse.osgi/bundles/347/1/.cp/lib/maven-e
> mbedder-2.0.2-dep.jar
> .../eclipse/configuration/org.eclipse.osgi/bundles/347/1/.cp/m2plugin.ja
> r
> 
> i need to do know how to do the following two things, but i cannot find
> any guidelines on how to do them.
> 
> 1.  inherit the classpath/dependencies from the calling pom, without
> having to explicity re-state them in under
> build.plugins.plugin.depedencies
> 2.  add some additional dependencies to the classpath within the plugin.
> these dependencies are all jars located in a directory.
> 
> thanks
> 
> jake
> 
> 
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org