How to attach IntelliJ to the liberty:run debug port when using a run configuration with maven?

Answered

Hello,

I am using the `liberty-maven-plugin`. It can run the `debug` goal to start which starts the Liberty server with the debug port 7777 by default. Now I want IntelliJ to use this port. So I created a maven run configuration which simply starts `liberty:debug`.

This is an exerpt of the log out:

    /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:58166,suspend=y,server=n -Dmaven.multiModuleProjectDirectory=/Users/dev/my-service “-Dmaven.home=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3” “-Dclassworlds.conf=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/m2.conf” “-Dmaven.ext.class.path=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-event-listener.jar” -javaagent:/Users/dev/Library/Caches/IntelliJIdea2019.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath “/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar” org.codehaus.classworlds.Launcher -Didea.version2019.2.4 -DskipTests=true liberty:debug
    Connected to the target VM, address: ‘127.0.0.1:58166’, transport: ‘socket’
    [INFO] Scanning for projects...

    // some logs about starting ...
    // and this one comes from Open Liberty
    [INFO] Listening for transport dt_socket at address: 7777'

As you can see, Liberty opens a debug port on 7777 while IntelliJ starts on a random port, here 58166. I have not found a way to set the port that IntelliJ uses to listen on in the Maven run configuration.

How do I connect to my debug port?

 

0
1 comment

Hi. IDEA supports application server debugging via dedicated Web Sphere run configuration.

0

Please sign in to leave a comment.