Reputation: 4826
Related to eclipse debug remote web application => How do I debug a remote application in my eclipse
How can I set / archive this in the mvn tomcat plugin? http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/tomcat7-maven-plugin/
The only thing that might help is setting systemProperty but that doesn't work for me ;/
Goal: let tomcat run on console via maven but enable remote debugging for different IDEs
(YES guys, we can run tomcat in Eclipse WTP! That's not the question ;)
Upvotes: 13
Views: 12048
Reputation: 4826
$ export MAVEN_OPTS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
$ mvn tomcat7:run-war
^^ that's it, not cool (as it is not in POM) but it works
Source: http://aaronz-sakai.blogspot.de/2009/02/debugging-jetty-when-running-mvn.html
Upvotes: 30
Reputation: 77
OR... you could simply add the following tag to your plugin configuration
<jpda>true</jpda>
Then when you execute: mvn tomcat7:run, it will start jpda on port 8000.
Funny thing is even though I have tested this and it works, I can't find any code in the opensource code base to explain why it works, nor have I found any way to change from the default port 8000.
Apache seems to have dropped the ball when it comes to documentation of this plugin.
Upvotes: -1
Reputation: 146
It's a bit old thread but for the sake of completeness I though i might add a little here.
The plugin does not provide debug options configuration for whatever strange reason. Thus your only option is to manually specify debug configuration to the JVM that runs the process. In your environment, there are three ways achieve this:
mvn -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y tomcat7:run-war
tomcat7:run
(or similar) and then navigate to the JRE tab. The VM arguments area is where you specify the debug configuration: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
pluginManagement
section of your project pom:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</pluginManagement>
Upvotes: 6