Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ debugger does not pause at breakpoints on Maven project

Problem

Since yesterday, I am unable to launch a proper debug of my tests. Debugger happily jumps over my breakpoints. I validated that the code was actually executed by adding some logs.

What I've tried so far

  • Synchronize project
  • Clean, reinstall and rebuild the project
  • Purge Maven dependencies
  • Upgrade IntelliJ IDEA to the last version
  • Read IntelliJ docs about configuring debugger options
  • Browse questions that had been asked before, with no success (for instance here, here and here).

More info about the project

The executed Java code is in one of the folders declared as test sources (one is "java" for Selenium tests, other is "scala" for Gatling tests).

My Maven command line is pretty straightforward: package clean -Dtest=MyTestClass integration-test.

EDIT: My POM configuration does mention reuseForks and forkCount. I've also tried playing with deprecated forkMode, but with no success.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.20.1</version>
    <configuration>
        <skip>${skip.selenium.tests}</skip>
        <parallel>none</parallel>
        <threadCount>1</threadCount>
        <reuseForks>false</reuseForks>
        <forkCount>0</forkCount>
        <disableXmlReport>false</disableXmlReport>
    </configuration>
    <executions>
        <execution>
            <id>runSeleniumTests</id>
            <phase>integration-test</phase>
            <goals>
                <goal>integration-test</goal>
            </goals>
        </execution>
    </executions>
</plugin>

What is funny, though: debugger actually stops at breakpoints when I right-click on the project root or on test sources root ("java" folder) and click on "Debug 'All tests'".

Any help... will help.

like image 643
Y-B Cause Avatar asked Feb 03 '26 00:02

Y-B Cause


1 Answers

If you are using surefire plugin it runs your test in another process hence you are not able to debug.

Use forkMode=never in your maven configuration

like image 60
Code_Eat_Sleep Avatar answered Feb 04 '26 14:02

Code_Eat_Sleep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!