title: ClassNotFound exception while using the Maven Shade Plugin
body: <p>I am trying to follow this link:
  <a href="http://maven.apache.org/plugins/maven-shade-plugin/examples.html" rel="nofollow noreferrer">http://maven.apache.org/plugins/maven-shade-plugin/examples.html</a></p>
  
  <p>I am new to Maven. I feel a bit out of depth trying to follow the example.</p>
  
  <p>I am able to get Quartz Scheduler to get working with Spring. I want to be able to run it from commandline using jar file.</p>
  
  <p>Here are the list of classes and pom file I used. </p>
  
  <p><img src="https://i.stack.imgur.com/ll9yT.png" alt="shade maven plugin"></p>
  
  <p>EDIT:</p>
  
  <p>I am able to get a shade jar file. I used mvn clean install</p>
  
  <p>but when I try to run it from the command line, I get the following errors.</p>
  
  <p><strong><code>C:\Users\SpringExample\target&gt;java -jar SpringExample-1.0-SNA
  PSHOT-shaded.jar
  Exception in thread "main" java.lang.NoClassDefFoundError: org/sonatype/haven/Ex
  odusCli
  Caused by: java.lang.ClassNotFoundException: org.sonatype.haven.ExodusCli
          at java.net.URLClassLoader$1.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
          at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
          at java.lang.ClassLoader.loadClass(Unknown Source)
  Could not find the main class: org.sonatype.haven.ExodusCli. Program will exit.</code></strong></p>
  
  <p>EDIT2:</p>
  
  <p>I used the following in the pom above using this link:</p>
  
  <p><a href="http://seanfreitag.wordpress.com/2011/07/25/create-an-executable-jar-with-dependencies-using-maven/" rel="nofollow noreferrer">http://seanfreitag.wordpress.com/2011/07/25/create-an-executable-jar-with-dependencies-using-maven/</a></p>
  
  <pre><code> &lt;project&gt;
    ...
    &lt;build&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.4&lt;/version&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;phase&gt;package&lt;/phase&gt;
              &lt;goals&gt;
                &lt;goal&gt;shade&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                &lt;transformers&gt;
                  &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt;
                    &lt;manifestEntries&gt;
                      &lt;Main-Class&gt;org.sonatype.haven.ExodusCli&lt;/Main-Class&gt;
                      &lt;Build-Number&gt;123&lt;/Build-Number&gt;
                    &lt;/manifestEntries&gt;
                  &lt;/transformer&gt;
                  &lt;transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"&gt;
                    &lt;resource&gt;META-INF/spring.handlers&lt;/resource&gt;
                  &lt;/transformer&gt;
                  &lt;transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"&gt;
                    &lt;resource&gt;META-INF/spring.schemas&lt;/resource&gt;
                  &lt;/transformer&gt;
                &lt;/transformers&gt;
              &lt;/configuration&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
    ...
  &lt;/project&gt;
  </code></pre>