dimanche 29 mai 2016

Remotely debug unit tests in Netbeans / Maven

I would like to launch and debug unit tests on a remote machine in a Maven project using Netbeans. I would like to be able to simply use "Debug Focused Test Method."

My original plan was to modify the Project's Actions to run maven via ssh after doing an rsync. It would have been perfectly simple, could be configured globally for all projects, and would not pollute maven files with dev-machine-specific stuff. However, I cannot find how to modify the actual command that launches maven using this approach. I can only modify the maven parameters/goals/etc that are passed when using "Debug Focused Test Method."

An idea is to replace Netbean's maven executable with a script. It would look for some magic parameters and activate the redirection logic. It could also call maven locally.

Another, simpler idea is to set up another goal using exec-maven-plugin or bash-maven-plugin. Probably won't be very flexible, however.

The last idea would be to write a Mojo (maven plugin) specifically for this task. It could perhaps automatically take all the parameters that Netbeans is passing and copying them to the remote invocation. Might be more flexible than exec-maven-plugin.

Aucun commentaire:

Enregistrer un commentaire