Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging maven without losing MAVEN_OPTS variable

rI want to run jetty:run in debug mode with MAVEN_OPTS setted in environment variable. But it seams like hardcode MAVEN_OPTS. Is it possible to set MAVEN_OPTS in command line like mvn MAVEN_OPTS=...

Thank you.

like image 474
robinmag Avatar asked Sep 29 '10 03:09

robinmag


People also ask

What is MAVEN_OPTS environment variable?

MAVEN_OPTS environment variable: This variable contains parameters used to start up the JVM running Maven and can be used to supply additional options to it. E.g. JVM memory settings could be defined with the value -Xms256m -Xmx512m .

Can we debug in Maven?

You can use the maven. surefire. debug property to debug your forked tests remotely, like this: mvn -Dmaven.


2 Answers

Is it possible to set MAVEN_OPTS in command line like mvn MAVEN_OPTS=...

No, MAVEN_OPTS is an environment variable, you can't set it on the command line. But you there is an alternative. Instead of mvn, you can simply run mvnDebug (a little variation of the former script that set debug options):

$ mvnDebug jetty:run
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000

I find this alternative pretty handy, and easier.

like image 75
Pascal Thivent Avatar answered Oct 27 '22 00:10

Pascal Thivent


Under Windows - I don't know. Under Linux/Bash - yes you can:

export MAVEN_OPTS="-Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
mvn jetty:run
like image 21
Henryk Konsek Avatar answered Oct 27 '22 00:10

Henryk Konsek