plugin dependencies on a third party jar file

View: New views
2 Messages — Rating Filter:   Alert me  

plugin dependencies on a third party jar file

by Nasser Nouri :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My NB plugin has dependencies  on a third party jar file. The jar file
is platform specific and cannot be shipped with the nbm file. The NB
plugin must use the specific jar file that is already installed on the
system. The NB  plugin is targeted for Solaris 10, 11, and Indiana. The
pathname to the jar file is the same for all releases of Solaris.

How can I specify dependencies on a jar file that is not bundled with
my  nbm file?

Thanks,
__Nasser

Re: plugin dependencies on a third party jar file

by Jesse Glick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nasser Nouri wrote:
> My NB plugin has dependencies  on a third party jar file. The jar
> file is platform specific and cannot be shipped with the nbm file.
> The NB plugin must use the specific jar file that is already
> installed on the system. The NB  plugin is targeted for Solaris 10,
> 11, and Indiana. The pathname to the jar file is the same for all
> releases of Solaris.
>
> How can I specify dependencies on a jar file that is not bundled with
> my NBM file?

I already responded to this off-list, but for the record: you cannot
currently specify a direct (Class-Path) extension on a JAR you do not
bundle.

You can create a custom ClassLoader which will load this JAR and do
whatever you want with it: either using reflection (appropriate if there
are only a handful of "entry point" methods in the foreign JAR you need
to call); or by creating a "bridge" JAR which can "see" both your
module's and the foreign JAR's code, implementing various interfaces
defined in your module, where the bridge is loaded together with the
foreign JAR by the custom ClassLoader. See o.apache.tools.ant.module for
a complete working example.