title: ClassNotFoundException when running jar but no issue while running the class
body: <p>I am getting a strange behaviour with my application.</p>
  
  <p>From the IDE (Intellij), launching the main class is working fine.</p>
  
  <p>When using </p>
  
  <blockquote>
    <p>mvn spring-boot:run</p>
  </blockquote>
  
  <p>the app works fine as well.</p>
  
  <p>But when trying to launch the application from the jar, I am getting </p>
  
  <pre><code>java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
  </code></pre>
  
  <p>As my final objective is to have it working with Docker, I would like it to run with:</p>
  
  <pre><code>java -jar ./target/mail-business-1.0-SNAPSHOT.jar
  </code></pre>
  
  <p>After checking few posts, I checked the dependencies, removed the target folder so it can be recreated but the issue persists.</p>
  
  <p>Would anyone have an idea? I am thinking about some dependencies compatibility but the tests I made so far were unsuccessful</p>
  
  <p>Below is my pom.xl</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;artifactId&gt;mail-business&lt;/artifactId&gt;
      &lt;groupId&gt;org.mail&lt;/groupId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
  
      &lt;dependencies&gt;
  
  
          &lt;!-- ===== Bibliothèques tierces ===== --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;5.1.3.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.apache.bval/bval-jsr --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.bval&lt;/groupId&gt;
              &lt;artifactId&gt;bval-jsr&lt;/artifactId&gt;
              &lt;version&gt;2.0.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.mail&lt;/groupId&gt;
              &lt;artifactId&gt;javax.mail-api&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.inject&lt;/groupId&gt;
              &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
              &lt;version&gt;1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-core&lt;/artifactId&gt;
              &lt;version&gt;5.1.3.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
              &lt;version&gt;2.1.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
  
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.1.2.RELEASE&lt;/version&gt;
              &lt;/plugin&gt;
  
  
  
  
  
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;classpathPrefix&gt;java/&lt;/classpathPrefix&gt;
                              &lt;mainClass&gt;org.mail.impl.ScheduledTasks&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
  
  
              &lt;!-- plugin 4- apache cxf codegen wsdl2java goal --&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
                  &lt;artifactId&gt;cxf-codegen-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.2&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;configuration&gt;
                              &lt;sourceRoot&gt;generated/java&lt;/sourceRoot&gt;
                              &lt;wsdlOptions&gt;
                                  &lt;wsdlOption&gt;
                                      &lt;wsdl&gt;
                                          https://raw.githubusercontent.com/xbreizh/troparo/e481ca9c19f78656678dfab01ca1a01f124c72e2/troparo-web/src/main/resources/org/troparo/web/services/MailService.wsdl
                                      &lt;/wsdl&gt;
                                  &lt;/wsdlOption&gt;
                                  &lt;wsdlOption&gt;
                                      &lt;wsdl&gt;
                                          https://raw.githubusercontent.com/xbreizh/troparo/e481ca9c19f78656678dfab01ca1a01f124c72e2/troparo-web/src/main/resources/org/troparo/web/services/ConnectService.wsdl
                                      &lt;/wsdl&gt;
                                  &lt;/wsdlOption&gt;
                              &lt;/wsdlOptions&gt;
                          &lt;/configuration&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;wsdl2java&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Thanks in advance</p>