I'm able to run my application fine with no errors with
mvn install
However when I try to enable remote debugging with
mvn install -Dmaven.surefire.debug
I get this error
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [open/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:734]
I understand that surefire uses port 5005. At the time of an error, I do see a process running on port 5005, but that was the process that was kicked off by the command itself
l@mac target % lsof -i tcp:5005
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 35842 267u IPv4 0x8763e5d80030efe5 0t0 TCP localhost:avt-profile-2 (LISTEN)
After exiting the mvn install command, I see that there's no process running on port 5005.
Does anyone know what could be causing this issue? Is there another port involved here?
To fix this I needed to disable forking - https://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html
Passing it as a command line argument didn't work for me. I had to also specify it in the pom file