Reputation: 338614
Into IntelliJ 2017.1 RC, I imported a simple Maven project created with the Quickstart Archetype.
When clicking the green-bug-icon to run in debug mode, the debugger panel does appear. Clicking the View Breakpoints
icon shows that I do indeed have multiple breakpoints in place, created by clicking in the gutter of the code editor. Yet all those breakpoints are bypassed, and the code execution completes.
Is there some trick to making the IntelliJ debugger, well, debug?
I am new to IntelliJ, more familiar with NetBeans.
Upvotes: 10
Views: 10387
Reputation: 338614
Something went wrong with the import of the Maven project into IntelliJ.
Try again.
.idea
and myapp.iml
items from project folder. Recompile MyApp.java
Debug 'MyApp.main()'
Then debugger works as expected, stopping on breakpoints.
Tip: Before importing a Maven project, edit the POM to specify a Java version as the compiler source & target. If omitted you get Maven's default of compiling as Java 5 (1.5) code. Per the Maven page, Setting the -source and -target of the Java Compiler
inject these four lines into your POM file, a pair of tags inside a properties
tag.
Here we specify Java 8 (1.8) be used by the compiler.
<project>
[...]
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
[...]
</project>
Upvotes: 6