> I have created a mvn plugin called "foo" that needs a jar file say
> "xyz.jar"
> in order to compile and run.  in the pom file of plugin project foo I have
> provided xyz.jar with "provided" scope in the dependencies section.


That is most likely not correct. If your plugin requires the xyz artifact
it should be declared with compile scope for the plugin.


> I do not want to package the xyz.jar file in the plugin.


You wouldn't package it with your plugin. It would be a dependency of your
plugin, in the same manner as you have dependencies of any Maven project.
It will be retrieved in normal Maven style, i.e. from the declared Maven
repos.


> The plugin "foo"  will be
> triggered by another project say "bar" in its install phase.


How you get that artifact into the (local) repo doesn't matter out of the
plugin's perspective. Don't think about this for solving this question of
yours.


> so I added the
> plugin foo in the <build><plugins><plugin>...</plugin></plugins></build>
> section of the project bar. project bar has the dependency of "xyz.jar"  in
> its <dependencies> section.  when I run install goal the classes present in
> the xyz.jar and which are refered by the plugin foo throw
> ClassNotFoundException at Runtime.
>

Right. When the plugin executes it will get its own classpath, which does
not include the dependencies of the project but only the ones of the
plugin. So just change the declared scope of the xyz artifact dependency in
your plugin's pom to compile and everything should just work!

/Anders


>
> Please let me know how to resolve this.
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/dependencies-needed-by-plugin-tp5781651.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to