The liberty:run goal of the liberty-maven-plugin provides a single goal to create a server, install needed features and deploy my app, but what if I want to attach a debugger to step through my application?
The liberty:debug goal isn't the answer since it doesn't perform all these actions in a single goal.
For recent versions (since v3.1) of the liberty-maven-plugin, like:
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.3.3</version>
</plugin>
there are a couple options:
-Dliberty.jvm.debug
property$ mvn liberty:run -Dliberty.jvm.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777"
Note the 'debug' part of the 'liberty.jvm.debug' property name can be any string.
liberty:dev
mode (goal) insteadThe 'dev' goal will also install an Open Liberty server in the foreground, and deploy your app to it, (like 'run'), while also creating a file "watcher" to detect project changes, upon which it will automatically update your installation, rebuild and redeploy your app, and rerun your tests. (And you can attach the debugger by default).
For more information see: