3

I have a java application running in IntelliJ. Can I know how to remote debug the application from maven command line.

I tried to use mvnDebug clean install. But this threw me an error saying command not found

Rakesh Gourineni
  • 1,361
  • 5
  • 16
  • 30
  • 1
    Not sure to understand the question. If your application is running inside IntelliJ, why would you want to remote-debug it using a Maven commandµ? – Tome Feb 11 '14 at 08:56
  • One of my testcases are wrking fie in IntelliJ but they are failing in when I run mvn clean test. Thats why I want to do remote debugging from command line – Rakesh Gourineni Feb 11 '14 at 14:43
  • 1
    possible duplicate of [In IntelliJ, how do i debug a maven test goal?](http://stackoverflow.com/questions/3784781/in-intellij-how-do-i-debug-a-maven-test-goal) – oberlies Feb 11 '14 at 17:22
  • @RakeshGourineni: It is hard to understand what you are trying to achieve. Please edit the question and reword it so that it includes the information from your question. – oberlies Feb 11 '14 at 17:25
  • @Rakesh, if it is surefire related, just have a look here: http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html – Tome Feb 12 '14 at 09:29

1 Answers1

6

You can use remote debugging:

mvn exec:exec -Dexec.executable="java" -Dexec.args="-classpath %classpath -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 com.mycompany.app.App"

Then in your eclipse, you can use remote debugging and attach the debugger to localhost:1044. Or configure the goals to debug configuration, create "Maven build" debug config:

Goals = -Dmaven.surefire.debug test
Profiles = myconfigprofile,weblogic

or for a specific TestSuite:

Goals = -Dmaven.surefire.debug -Dtest=com.myorg.mypkg/MyTestSuite.java test
Profiles = myconfigprofile,weblogic

Create additional "Remote Java Application" config:

Host = localhost Port = 5005

You can find more documentation here: http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html

Benjamin RD
  • 11,516
  • 14
  • 87
  • 157
  • 2
    See [here](http://stackoverflow.com/questions/138511/what-are-java-command-line-options-to-set-to-allow-jvm-to-be-remotely-debugged) for the correct command line options to use. XDebug is very slow. – Boris the Spider Feb 10 '14 at 20:15