Issue Details (XML | Word | Printable)

Key: MNGECLIPSE-406
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Vitaliy Semochkin
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Maven Integration for Eclipse

[mng] break points do not work

Created: 02/Oct/07 07:48 AM   Updated: 28/May/08 12:26 AM
Return to search
Component/s: Maven Embedder
Affects Version/s: 0.0.11
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive m2test.zip (3 kB)

Environment: Windows/Linux Eclipse 3.3.0/3.2.2

Testcase included: yes


 Description  « Hide

Tests run during test phase.
It is possible to pause build process via Susspend button in debug perspective\debug view.
But break points don't work as if building process does not see source code.

Sample project as it was asked in mailing list attached.



Aleksandr added a comment - 05/Oct/07 07:33 AM

I have the same problem. It is not possible to use breakpoints as it was described in the manual for maven eclipse plugin.


Eugene Kuleshov added a comment - 05/Oct/07 06:25 PM - edited

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). In result Eclipse don't have control on that new JVM and breakpoints are not being initialized.

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>

Damian Carrillo added a comment - 05/Mar/08 08:16 PM - edited

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.