How can I debug new detectors in find-sec-bugs without repackaging the entire project?

24 Views Asked by At

How to quickly debug and modify code?

I am not a professional java developer and I am confused about how to debug this find-sec-bugs project. Whenever I add a new detector, do I need to package the entire project and replace plugins.jar in findsecbugs-cli, can I debug the source code I wrote directly with IDEA?

1

There are 1 best solutions below

0
On

You can debug it directly in your IDE. Take a look at the test cases. Every test case run SpotBugs with the FSB plugin loaded and do assertions on the results. It is also an opportunity to profile/debug/trace the execution from the IDE (IntelliJ or Eclipse).

If you want to attach to the CLI, you will need to use remote debugging. You can do this by adding
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8000 to the java command located in findsecbugs.sh or findsecbugs.bat.

Ref: Java Application Remote Debugging