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:
1. Add a -Dliberty.jvm.debug
property
(using "run" as the OP asked about)
$ 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.
2. Use the liberty:dev
mode (goal) instead
(an even better, richer approach)
The '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:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…