IntelliJ IDEA Spring Boot Run Configuration vs Maven/Gradle Plugin: Decision Guide
Learn when to use IntelliJ IDEA's native Spring Boot Run/Debug configuration versus an external Maven/Gradle plugin, with a compact trade‑off table and step‑by‑step validation.
12 Aug 2025, 06:07 UTC

Decision and Constraints
State the decision: use IntelliJ IDEA's built‑in Spring Boot Run/Debug configuration when you need fast startup, integrated breakpoint debugging, and class hot‑swap during development. Constraints: you must be using IDEA Ultimate edition, have a compatible JDK, and the project must already contain a Spring Boot starter. The IDE consumes more memory than a plain command‑line launch, and the launch settings are not automatically reused in CI pipelines.
Comparison of Options
| Aspect | IDEA Run Configuration | External Maven/Gradle Plugin |
|---|---|---|
| Startup speed | Instant (IDE internal launcher) | Depends on Maven/Gradle lifecycle; slightly slower |
| Debugging | Breakpoints, step‑through, hot‑swap via IDE debugger | Breakpoints only after attaching a remote debugger (default port 5005) |
| Hot swap | Automatic for method‑body changes while debugging | Not automatic; requires manual reattach or restart |
| CI reproducibility | Launch parameters must be mirrored in CI to avoid "works in IDE" issues | Identical command used locally and in CI |
| Resource usage | IDEA process + JVM | Only JVM (plus Maven/Gradle daemon) |
Trade‑offs
Choosing the IDEA configuration gives you the quickest feedback loop and the most seamless debugging experience, but you must keep the launch configuration (JVM args, active profiles, etc.) in sync with what your CI uses. The external plugin approach guarantees that the exact same command runs everywhere, yet you lose the IDE’s hot‑swap convenience and need to attach a debugger manually if you want breakpoints.
Concrete Implementation – Setting Up the IDEA Configuration
- Open
Run → Edit Configurations. - Click the
+button, selectSpring Boot. - Fill in:
Name: e.g.,MyApp‑DevMain class: the@SpringBootApplicationclass.JRE: choose a JDK 11 or newer that matches your build.VM options: any props you need, e.g.,-Dspring.profiles.active=dev.Enable alternative JRE for debugging(optional).- Click
ApplythenOK. - Press the
Debugbutton (bug icon) to start the app in debug mode.
While the application is running, make a small change to the body of a method (for example, add a log statement). IDEA will show a notification like Hot swapped method com.example.MyService.doWork(). The change takes effect immediately without a restart.
Validation – Comparing with External Launch
- Open a terminal in the project root.
- Run the Maven wrapper:
./mvnw spring-boot:run(or Gradle:./gradlew bootRun). - In IDEA, choose
Run → Attach to ProcessorRun → Debug…and set the host tolocalhostand port5005(the default debug port used by the plugin). - Set a breakpoint in the same method you changed earlier.
- When the breakpoint hits, you can step through code, but note that editing the method body while attached will not trigger a hot swap; you will need to restart the application or relaunch the plugin to see the change.
Limitations and Practical Checks
- Hot swap only works for changes inside method bodies. Adding, removing, or changing method signatures or fields requires a full restart regardless of launch method.
- If you change VM options or active profiles in the IDEA configuration, repeat the same changes in your CI script to avoid divergence.
- To verify that your IDEA launch matches the external build, compare the console output: the lines printed by Spring Boot (e.g.,
Started MyApplication in X.XXX seconds) should be similar in timing and active profiles. - You can also check the effective classpath by running
mvn dependency:tree(or Gradle equivalent) and ensuring no extra IDE‑specific libraries are added.
By following the steps above you can decide which launch method fits your workflow and validate that the chosen option behaves as expected.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.