<div dir="ltr">Hi Jay,<div><br></div><div><div>> when I export the application as a runnable jar, ij.plugin()service</div><div>> returns all the Command.class plugins but 0 plugins of type</div><div>> JEXPlugin.class</div>
</div><div><br></div><div>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?</div>
<div><br></div><div>I filed an issue:</div><div><a href="https://github.com/scijava/scijava-common/issues/40" target="_blank">https://github.com/scijava/scijava-common/issues/40</a><br></div><div><br></div><div>Brian Northan wrote:</div>
<div><br></div><div><div>> To create an executable jar you might want to look at the maven</div><div>> assembly plugin.</div></div><div><br></div><div>That is indeed how we create the current ImageJ uberjar at:</div>
<div><a href="http://developer.imagej.net/how-can-i-call-imagej-my-software">http://developer.imagej.net/how-can-i-call-imagej-my-software</a><br></div><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>Regards,</div><div>Curtis</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 26, 2014 at 3:14 AM, Jay Warrick <span dir="ltr"><<a href="mailto:warrick@wisc.edu" target="_blank">warrick@wisc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Sorry resending this from a registered email.<br>
<br>
Hi All,<br>
<br>
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);"<br>
<br>
Any idea why or how to fix it?<br>
<br>
Thanks,<br>
<br>
Jay<br>
<br>
_______________________________________________<br>
ImageJ mailing list<br>
<a href="mailto:ImageJ@loci.wisc.edu" target="_blank">ImageJ@loci.wisc.edu</a><br>
<a href="http://loci.wisc.edu/mailman/listinfo/imagej" target="_blank">http://loci.wisc.edu/mailman/listinfo/imagej</a><br>
</blockquote></div><br></div></div>