mvn spring-bootrun doesn't start spring
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
When mvn spring-boot:run does not appear to start your Spring Boot application, the failure is usually in one of a small number of places: the Maven plugin is missing or misconfigured, the app cannot find its main class, startup fails immediately, or the application starts and exits because it is not actually running a web server. The fastest way to fix it is to separate “Maven did not launch” from “Spring launched and then failed.”
Verify the Maven Plugin and Main Class
The spring-boot:run goal comes from the Spring Boot Maven plugin. If that plugin is absent, the command will not know how to launch your app.
A minimal pom.xml setup looks like this:
Your application entry point also has to be valid:
If the plugin is present but the main class is missing or not on the source path Maven compiles, spring-boot:run will fail before Spring really starts.
Distinguish “Did Not Start” From “Started and Exited”
A common confusion is that the command prints a banner and some logs, then returns to the shell. That often means Spring started successfully but had no reason to keep running.
Typical causes:
- no web starter on the classpath
- '
spring.main.web-application-type=none' - the app is just a command-line task and finished normally
If you expect a web app, make sure you actually depend on spring-boot-starter-web or another server starter. Otherwise the JVM may exit immediately after startup.
Read the Real Startup Failure
If the process stops with a stack trace, focus on the first meaningful exception, not the final Maven message. Common startup blockers include:
- port already in use
- missing configuration properties
- bean creation failure
- bad database connection
- profile-specific config not found
Run with more visibility when needed:
Or pass Spring arguments directly:
That usually tells you whether the issue belongs to Maven, Spring configuration, or the application itself.
Check the Working Directory and Profiles
spring-boot:run uses your current project layout and runtime configuration. If your app depends on a profile, environment variable, or external file, launching from Maven may behave differently than running from the IDE.
For example:
If the app works in the IDE but not from Maven, compare:
- active profiles
- environment variables
- JVM options
- working directory assumptions
The code may be fine while the runtime inputs differ.
Common Pitfalls
The biggest mistake is assuming spring-boot:run failed when the application actually started and exited normally because it is not a server process.
Another mistake is reading only the last Maven line instead of the first Spring exception that explains the real failure.
A third mistake is forgetting that IDE launches often inject profiles, env vars, or classpath differences that mvn spring-boot:run does not automatically reproduce.
Summary
- Make sure the Spring Boot Maven plugin is present in
pom.xml. - Verify that your
@SpringBootApplicationmain class is valid and compiled. - Check whether the app is failing on startup or starting and exiting normally.
- Use debug flags to surface the real exception.
- Compare profiles and runtime inputs with the IDE if Maven behaves differently.
Related reading
- mvn spring-bootrun vs java -jar
- Naming of enums in Java Singular or Plural?
- Naming threads and thread-pools of ExecutorService
- Natural sort order string comparison in Java - is one built in?
- MvvmCross UI freeze when calling async method during initialization
- My Android device does not appear in the list of adb devices
- Need for custom serializers while using derivatives of ArrayList as value in Hazelcast
- Netty and Project Loom

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.