How to setup mvn for debugging fiji plugins?

I’m having a hard time setting up my development environment.

I want to try to hack around with the TrakEM2 plugin. I can’t figure out how to attach the debugger when launching ImageJ

The following correctly attaches the debugger but many plugins don’t work, and I don’t see the Fiji logo in the title bars.

<configuration>
   <executable>java</executable>
   <commandlineArgs>-jar -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}  "${imagej.app.directory}/jars/ij-1.50e.jar"</commandlineArgs>
   <mainClass>ij.ImageJ</mainClass>
   <workingDirectory>${imagej.app.directory}</workingDirectory>
</configuration>

On the other hand if I launch like, the debugger doesn’t attach from the IDE but the plugins work…

<configuration>
   <executable>${imagej.app.directory}/ImageJ-win64.exe</executable>
   <commandlineArgs>"-agentlib:jdwp=server=y,suspend=y,transport=dt_socket,address=${jpda.address}"</commandlineArgs>
   <workingDirectory>${imagej.app.directory}</workingDirectory>
</configuration>

Whats the paradigmatic way to do this? What do you guys have in your POM files?

For remote debugging we don’t launch via Maven. The ImageJ launcher has a flag to handle this - so you can just start your normal Fiji installation, then attach to the running process (e.g. by launching TrakEM2 as a remote application via Eclipse).

Alternatively you can launch directly from Eclipse for a non-remote workflow, by using the Debug helper class. But this won’t give you the full environment you’d get from remote debugging.

ij.ImageJ is ImageJ 1.x; Fiji uses net.imagej.Main as its entry point.

That’s because -agentlib is being passed as an argument to the launcher, and apparently the launcher is not propagating that argument to the JVM. If you just use\

   <commandlineArgs>"--debugger=${jpda.address}"</commandlineArgs>

I’m guessing it will work…

2 Likes