title: ClassNotFoundException: org.apache.commons.cli.ParseException with maven
body: <p>I am trying to run a java project from the command line in linux :</p>
  
  <blockquote>
    <p>$ java -jar target/my-app.jar -csv test.csv</p>
  </blockquote>
  
  <p>and got this error</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
      at java.lang.Class.getMethod0(Class.java:2774)
      at java.lang.Class.getMethod(Class.java:1663)
      at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
  Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
  </code></pre>
  
  <p>I'm using maven-3, here my build maven configuration :</p>
  
  <pre><code>&lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                      &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
                      &lt;sourceEncoding&gt;${project.build.sourceEncoding}&lt;/sourceEncoding&gt;
                      &lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
                  &lt;/configuration&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;2.6&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;mainClass&gt;${appClass}&lt;/mainClass&gt;
                              &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                              &lt;useUniqueVersions&gt;false&lt;/useUniqueVersions&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>
  
  <p>And my commons-cli dependency declaration </p>
  
  <pre><code>        &lt;!-- CLI --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-cli&lt;/groupId&gt;
              &lt;artifactId&gt;commons-cli&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>If I remove code &amp; dependencies into my class I get no more error.</p>
  
  <p>Thank you !</p>