Question: I have a project made of several Maven projects, where the tests are in separated modules. E.g:

```
com.xyz.abc.feature.model
com.xyz.abc.feature.model.test

```

The tests are JUnit tests, and I have been running them from the command line with `mvn install`. I want to step through the code in a specific test, so I have imported the project into Eclipse as a Maven Project. I tried putting a breakpoint in the unit test, Eclipse does not stop at it when executing the `mvn install` goal.

How can I debug a specific test in this situation?

Answer: 
Maven SureFire plugin runs the test in a different process by default. That's likely why it wasn't working for you. You would first disable forking by adding this to your pom.xml:

```
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <forkMode>never</forkMode>
                </configuration>
            </plugin>
        </plugins>
    </build>  

```

Then follow these steps to debug:

1. Launch your test with debug mode:

Go to the folder where your pom.xml is located. Assuming you want to debug up to the 'install' phase, which also covers your test. Run this command

```
mvnDebug install

```

This will start a process and wait on default port 8000 (your port could be different, check your output display). My test shows this output:

`Listening for transport dt_socket at address: 8000`

2. Use a remote debugger in Eclipse to connect to the process started in step 1:

Set (or import) projects in Eclipse if you haven't, then go to menu 'Run' -> 'Debug Configuration' -> 'Remote Java Application', and create a new launch configuration. Make sure the port number matches the one displayed in output from step 1. Click 'Debug'. This will connect the Eclipse debugger to your process started in step 1. If you have a breakpoint set in your Eclipse source editor, then it will stop right there.

Some people would say that, by doing so, you are really debug Maven. I tested it and this approach worked just fine. As long as you don't have Maven source code in your Eclipse project, and it stops at the breakpoint set in your own project source code, this just works great!
Just open the test in eclipse, double-click on the test name to select it (actually just clicking in the test-name to put the cursor in it should be enough, or you can e.g. select it in the outline view), then right-click and choose `Debug As` > `JUnit Test`