4

I am running a spring integration test using maven. I am trying to run it with debug port enabled so that I can attach to it from IntelliJ idea.

The following command line used to work in the past. It used to allow the surefire bootup to initialize, and then wait to attach to port 8000 before continuing with the test:

-Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" -DtestIntegration test

However this is now giving me the following exception:

[ERROR] No plugin found for prefix 'runjdwp' in the current project and in the plugin groups [com.zillow, org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/ferozed/.m2/repository-p4), nexus (http://repo.zillow.local/content/groups/public)] -> [Help 1] org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'runjdwp' in the current project and in the plugin groups [com.zillow, org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/ferozed/.m2/repository-p4), nexus (http://repo.zillow.local/content/groups/public)] at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:93) at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:260) at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:220) at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106) at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:86) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:98) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)

Any ideas how I can get this to work?

feroze
  • 7,380
  • 7
  • 40
  • 57

2 Answers2

5

I remember dealing with this before. The debug options you are using may have been deprecated in your version of Java. Java 5 and under used -Xrunjdwp. I believe Java 7 and up (not sure about 6, used both?) use agentlib:jdwp. I recommend checking out this answer on SO.

https://stackoverflow.com/a/173447/50558

Community
  • 1
  • 1
XORshift
  • 358
  • 4
  • 11
2

None of the plugin approaches (-Xrunjdwp, or -Xagentlib ) worked for me.

So, I gave up and ran the test with -DforkMode=never for the surefire plugin, and that made sure that the test ran in-process with the maven execution. Then I could attach to the process.

I have read elsewhere that this is not safe, as the classpath of the invocation might get shared with the classpath of the test, but I could not find any other way to make my scenario work.

feroze
  • 7,380
  • 7
  • 40
  • 57