Maven Assembly Plugin and IJ Commands

maven
imagej

#1

Hi all

I have a plugin I am building that is made of several jars, and I am trying to release it as one jar, using the maven assembly plugin.

The issue I am running into is that ImageJ does not seem to find my commands, and add them to the menu.

If I do not use the assembly plugin and just copy my jars to the Fiji jars directory everything is fine.

Is there any reason it won’t recognize commands when the individual jars are packed together using the assembly plugin??

Is there a size limit that prevents large jars from being scanned for commands?? If so what is the limit??

I am a newbie when it comes to building assemblies using maven. My goal is to simply pack a few jars together so I don’t have to distribute them individually. I am open to other suggestions regarding how I can achieve this.

Thanks


#2

IIUC, the maven-built jar files contain an org.scijava.plugin.Plugin file in their META-INF/json directory (or a plugins.config in the case of ImageJ 1.x plugins) that defines if and where they show up in the menu.

When using the maven assembly plugin, you might have to make sure that something equivalent exists in your final jar.


#3

Thanks @imagejan. I finally solved this, and it was related to the org.scijava.plugin.Plugin file. First I had to switch to the maven shade plugin, instead of the assembly plugin. Then I had to add the following snippet to the shade plugin to get it to combine the org.scijava.plugin.Plugin files of each project.

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/json/org.scijava.plugin.Plugin</resource>
</transformer>