[ImageJ-devel] [LOCI ImageJ] IJ2 Plugin Service
Curtis Rueden
ctrueden at wisc.edu
Wed Apr 30 09:55:33 CDT 2014
Hi Jay,
> when I export the application as a runnable jar, ij.plugin()service
> returns all the Command.class plugins but 0 plugins of type
> JEXPlugin.class
This is an issue we have discussed before: Eclipse creates uberjars using a
"jar-in-jar" approach, and SciJava Common's plugin mechanism does not read
the metadata out of a jar-in-jar. Almost certainly this is because the
classloader being used to discover the SciJava plugins is not the one
embedded in the uberjar to enable loading of classes from inside nested
JARs. The question is: why not?
I filed an issue:
https://github.com/scijava/scijava-common/issues/40
Brian Northan wrote:
> To create an executable jar you might want to look at the maven
> assembly plugin.
That is indeed how we create the current ImageJ uberjar at:
http://developer.imagej.net/how-can-i-call-imagej-my-software
However, that uberjar does not shade (i.e., rename) its dependencies, and
is hence broken when attempting to combine it with other versions of those
same dependencies. So we discourage its use. To create an uberjar with
properly shaded dependencies, the maven-shade-plugin can be used. We
haven't had time to experiment with this approach yet.
The Eclipse "jar-in-jar" approach seems potentially useful, except for the
annoying classloader issues that go along with it, because it avoids
multiple JARs with the same contents overwriting on one another's resources.
Regards,
Curtis
On Sat, Apr 26, 2014 at 3:14 AM, Jay Warrick <warrick at wisc.edu> wrote:
> Sorry resending this from a registered email.
>
> Hi All,
>
> I use Eclipse and use the eclipse function to export my program as a
> runnable jar with referenced jars packaged in the application jar. I use
> the IJ plugin service to discover both IJ plugins of type Command.class as
> well as my own type called JEXPlugin.class. When I run the application from
> eclipse, the JEXPlugins are discovered by the ij.plugin() service. However,
> when I export the application as a runnable jar, ij.plugin()service returns
> all the Command.class plugins but 0 plugins of type JEXPlugin.class using
> the call "ij.plugin().getPluginsOfType(JEXPlugin.class);"
>
> Any idea why or how to fix it?
>
> Thanks,
>
> Jay
>
> _______________________________________________
> ImageJ mailing list
> ImageJ at loci.wisc.edu
> http://loci.wisc.edu/mailman/listinfo/imagej
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20140430/603c1a1e/attachment.html>
More information about the ImageJ-devel
mailing list