java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication Maven

If you would like to stay in spring boot space just set the pom packaging to jar

<packaging>jar</packaging>

and add the spring-boot-maven-plugin to you build properties in the pom.xml file:

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
  </plugins>
</build>

then a simple mvn package command will create a complete executable jar file.

See the very good spring reference doc for more details (doing it gradle style also)
spring reference doc

Leave a Comment