Debug maven scala project

507 views
Skip to first unread message

Wei Wang

unread,
Sep 4, 2013, 3:59:45 AM9/4/13
to maven-a...@googlegroups.com
Hi all,

I want to debug a maven scala project on a linux server. I googled for a while, the most discussed debugging option for maven project is remote debug. I tried the following command:

$ export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=2293,server=y,suspend=n"
$ mvn scala:run

Listening for transport dt_socket at address: 2293
[INFO] Scanning for projects...
[INFO]  ..............

But it didn't stop to wait for connection from my local IDEA debugger.
Can anyone give me some advice on it?

                                        
BTW, is there any way to debug the maven scala project using command line?


Regards

David Bernard

unread,
Sep 4, 2013, 4:13:32 AM9/4/13
to Maven and Scala
Hi,

Compilation, run,... are done on a forked process (by default) that ignore MAVEN_OPTS.
You can try to add <JvmArgs> into your pom.xml under a <launcher> configuration for debug, as is no need to remember cli options for futur use. (you can have a regular launcher and a debug launcher)

see :
* http://davidb.github.io/scala-maven-plugin/example_run.html
* http://davidb.github.io/scala-maven-plugin/run-mojo.html


--
 
---
You received this message because you are subscribed to the Google Groups "Maven and Scala" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-and-sca...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

David Bernard

unread,
Sep 4, 2013, 4:17:48 AM9/4/13
to Maven and Scala
something like :

        <launcher>
          <id>debug</id>
          <mainClass>org.example.MyClass</mainClass>
          <!-- args are optional -->
          <args>
            <arg>arg1</arg>
          </args>
          <jvmArgs>
            <jvmArg>-Xmx128m</jvmArg>
            <jvmArg>-Xdebug</jvmArg>
            <jvmArg>-Xnoagent</jvmArg>
            <jvmArg>-Djava.compiler=NONE</jvmArg>
            <jvmArg>-Xrunjdwp:transport=dt_socket,address=2293,server=y,suspend=n</jvmArg>
          </jvmArgs>
        </launcher>


mvn scala:run -Dlauncher=debug

stoto79

unread,
Mar 24, 2017, 6:03:42 PM3/24/17
to Maven and Scala
Hi, David,I see this is an old thread, but I just found it. So I am setting the above parameters in jvmArgs but Maven is still not pausing for me but brushing right past it. I get a message in console Listening for transport dt_socket at address: 5005 but then it just goes on and runs the program without waiting for me to connect. Any ideas?
Reply all
Reply to author
Forward
0 new messages