|
This happens because Maven's surefire plugin run tests in a separate JVM (default fork setting is "once" http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html Jason, we need to tweak surefire plugin to use some plexus service for spawhing such external jvms, so Eclipse plugin could substitute custom implementation of such service and have better control on new JVMs. Other plugins, including Cargo, Jetty, Terracotta would also benefit from this, so as things that runs on CI servers. As a workaround you can tell surefire plugin to not fork JVM when running tests. I've verified that with the following config configuration and it work ok: <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>never</forkMode>
</configuration>
</plugin>
</plugins>
</build>
What you are trying to accomplish can be achieved with the debugForkedProcess parameter to the maven-surefire-plugin, I believe. Like Eugene said above maven forks a separate process by default, which you can remote debug on port 5005. If you have a surefire configuration like the following: <?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>m2test</groupId>
<artifactId>m2test</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<debugForkedProcess>true</debugForkedProcess>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
you can have maven run your tests withing eclipse by running mvn test through the "External Tools" dialog. Then once you do that the executing thread will sit there and wait for a connection on port 5005, and you simply remote debug it with the Standard Socket Attach conection type, localhost as the host, and 5005 as the port. I'm pretty sure this will suit your needs. |
||||||||||||||||||||||||||||||||||||||||||||||
I have the same problem. It is not possible to use breakpoints as it was described in the manual for maven eclipse plugin.