title: Embedded Tomcat + Spring file-upload: HTTP 404
body: <p>I can open myApp throw Internet Browser if I start it via Eclipse, but, although I can start the Embedded server throw command line (java -jar myApp.jar) I am getting HTTP Status 404. Probably some issue with context but I can't figure out what is wrong.</p>
  
  <p>Kindly, see below the structure in Eclipse and in myApp.jar. The application is basically compound by 5 files: two placed in com.mycompany.myapp.batchs.AuthFileUpload (App.class with main method and FileUploadController.class as a very simple controller). Other three files, App-servlet.xml, web.xml and index.jsp placed in WEB-INF.</p>
  
  <p>Other possible reason can be I should point straigh to the classes in "tomcat.addWebapp("/", "the_place_where_classes_can_be_found_in_myApp.jar)". If so, how can I do it?</p>
  
  <p>Index.jsp and the FileUploadController.java are too simple so it is pointless show both here.</p>
  
  <p>App class</p>
  
  <pre><code> public static void main(String[] args) throws IOException,
                   ServletException, LifecycleException {
            Tomcat tomcat = new Tomcat();
  
            tomcat.setPort(8080);
  
  
            tomcat.setBaseDir("C:\\temp\\");
            tomcat.addWebapp("/", "C:\\temp\\");
            tomcat.start();
            tomcat.getServer().await();
  
     }
  </code></pre>
  
  <p>App-servlet.xml</p>
  
  <pre><code>&lt;context:component-scan base-package="com.mycompany.myapp.batchs.AuthFileUpload" /&gt;
  
  &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
   &lt;property name="prefix" value="/WEB-INF/" /&gt;
   &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" /&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <p></p>
  
  <p></p>
  
  <pre><code>   &lt;display-name&gt;Spring MVC Application&lt;/display-name&gt;
     &lt;servlet&gt;
        &lt;servlet-name&gt;App&lt;/servlet-name&gt;
        &lt;servlet-class&gt;
           org.springframework.web.servlet.DispatcherServlet
        &lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
     &lt;/servlet&gt;
  
     &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;App&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/&lt;/url-pattern&gt;
     &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>POM.xml:</p>
  
  <pre><code>&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;groupId&gt;com.myCompany.myApp.batchs&lt;/groupId&gt;
         &lt;artifactId&gt;AuthFileUpload&lt;/artifactId&gt;
         &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
         &lt;packaging&gt;jar&lt;/packaging&gt;
         &lt;name&gt;AuthFileUpload&lt;/name&gt;
         &lt;url&gt;http://maven.apache.org&lt;/url&gt;
         &lt;properties&gt;
                &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
                &lt;tomcat.version&gt;8.0.32&lt;/tomcat.version&gt;
                &lt;java.version&gt;1.8&lt;/java.version&gt;
                &lt;maven.compiler.plugin.version&gt;2.1&lt;/maven.compiler.plugin.version&gt;
                &lt;spring.version&gt;4.2.5.RELEASE&lt;/spring.version&gt;
         &lt;/properties&gt;
  
  
         &lt;dependencies&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                       &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
                       &lt;version&gt;${spring.version}&lt;/version&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
                       &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
                       &lt;artifactId&gt;tomcat-embed-logging-juli&lt;/artifactId&gt;
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
                       &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                       &lt;artifactId&gt;tomcat-jasper&lt;/artifactId&gt;
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                       &lt;artifactId&gt;tomcat-jasper-el&lt;/artifactId&gt;
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                       &lt;artifactId&gt;tomcat-jsp-api&lt;/artifactId&gt;
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
                &lt;/dependency&gt;
                &lt;dependency&gt;
                       &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
                       &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
                       &lt;version&gt;1.3.1&lt;/version&gt;
                &lt;/dependency&gt;
  
  
         &lt;/dependencies&gt;
         &lt;build&gt;
                &lt;finalName&gt;embeddedApp&lt;/finalName&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;${maven.compiler.plugin.version}&lt;/version&gt;
                             &lt;configuration&gt;
                                    &lt;source&gt;${java.version}&lt;/source&gt;
                                    &lt;target&gt;${java.version}&lt;/target&gt;
                             &lt;/configuration&gt;
                       &lt;/plugin&gt;
  
                       &lt;plugin&gt;
                             &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                             &lt;artifactId&gt;appassembler-maven-plugin&lt;/artifactId&gt;
                             &lt;version&gt;1.1.1&lt;/version&gt;
                             &lt;configuration&gt;
  &lt;assembleDirectory&gt;target&lt;/assembleDirectory&gt;
                                    &lt;programs&gt;
                                           &lt;program&gt;
                                                  &lt;mainClass&gt;com.myCompany.myApp.batchs.AuthFileUpload.App4&lt;/mainClass&gt;
  
                                                  &lt;name&gt;App4&lt;/name&gt;
  
                                           &lt;/program&gt;
                                    &lt;/programs&gt;
                             &lt;/configuration&gt;
                             &lt;executions&gt;
                                    &lt;execution&gt;
                                           &lt;phase&gt;package&lt;/phase&gt;
                                           &lt;goals&gt;
                                                  &lt;goal&gt;assemble&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><a href="https://i.stack.imgur.com/TAuzf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TAuzf.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/okMoS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/okMoS.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/biV1G.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/biV1G.jpg" alt="enter image description here"></a></p>
  
  <p>***Added in 2016/March/04 </p>
  
  <p><a href="https://i.stack.imgur.com/qlpfi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qlpfi.jpg" alt="Executable Jar"></a></p>
  
  <p>*** Added in 2016/March/07 at 5pm Brasilia timezone</p>
  
  <pre><code>C:\STS\wsRestTemplate\TestDeployment\target&gt;cd ..
  
  C:\STS\wsRestTemplate\TestDeployment&gt;java -version
  Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
  java version "1.8.0_65"
  Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
  Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
  
  C:\STS\wsRestTemplate\TestDeployment&gt;mvn clean package
  Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
  [INFO] Scanning for projects...
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building AuthFileUpload 0.0.1-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ AuthFileUpload ---
  [INFO] Deleting C:\STS\wsRestTemplate\TestDeployment\target
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ AuthFileUp
  load ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 3 resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ AuthFileUploa
  d ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 2 source files to C:\STS\wsRestTemplate\TestDeployment\target\c
  lasses
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Au
  thFileUpload ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory C:\STS\wsRestTemplate\TestDeployment\
  src\test\resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ AuthF
  ileUpload ---
  [INFO] No sources to compile
  [INFO]
  [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ AuthFileUpload ---
  
  [INFO] No tests to run.
  [INFO]
  [INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ AuthFileUpload ---
  [INFO] Building jar: C:\STS\wsRestTemplate\TestDeployment\target\embeddedApp.jar
  
  [INFO]
  [INFO] --- appassembler-maven-plugin:1.10:assemble (default) @ AuthFileUpload --
  -
  [WARNING] The usage of program name (App) is deprecated. Please use program.id i
  nstead.
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\springframework\s
  pring-web\4.2.5.RELEASE\spring-web-4.2.5.RELEASE.jar to C:\STS\wsRestTemplate\Te
  stDeployment\target\repo\org\springframework\spring-web\4.2.5.RELEASE\spring-web
  -4.2.5.RELEASE.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\springframework\s
  pring-aop\4.2.5.RELEASE\spring-aop-4.2.5.RELEASE.jar to C:\STS\wsRestTemplate\Te
  stDeployment\target\repo\org\springframework\spring-aop\4.2.5.RELEASE\spring-aop
  -4.2.5.RELEASE.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\aopalliance\aopallian
  ce\1.0\aopalliance-1.0.jar to C:\STS\wsRestTemplate\TestDeployment\target\repo\a
  opalliance\aopalliance\1.0\aopalliance-1.0.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\springframework\s
  pring-beans\4.2.5.RELEASE\spring-beans-4.2.5.RELEASE.jar to C:\STS\wsRestTemplat
  e\TestDeployment\target\repo\org\springframework\spring-beans\4.2.5.RELEASE\spri
  ng-beans-4.2.5.RELEASE.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\springframework\s
  pring-context\4.2.5.RELEASE\spring-context-4.2.5.RELEASE.jar to C:\STS\wsRestTem
  plate\TestDeployment\target\repo\org\springframework\spring-context\4.2.5.RELEAS
  E\spring-context-4.2.5.RELEASE.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\springframework\s
  pring-core\4.2.5.RELEASE\spring-core-4.2.5.RELEASE.jar to C:\STS\wsRestTemplate\
  TestDeployment\target\repo\org\springframework\spring-core\4.2.5.RELEASE\spring-
  core-4.2.5.RELEASE.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\commons-logging\commo
  ns-logging\1.2\commons-logging-1.2.jar to C:\STS\wsRestTemplate\TestDeployment\t
  arget\repo\commons-logging\commons-logging\1.2\commons-logging-1.2.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\hibernate\hiberna
  te-validator-annotation-processor\5.2.4.Final\hibernate-validator-annotation-pro
  cessor-5.2.4.Final.jar to C:\STS\wsRestTemplate\TestDeployment\target\repo\org\h
  ibernate\hibernate-validator-annotation-processor\5.2.4.Final\hibernate-validato
  r-annotation-processor-5.2.4.Final.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\springframework\s
  pring-webmvc\4.2.5.RELEASE\spring-webmvc-4.2.5.RELEASE.jar to C:\STS\wsRestTempl
  ate\TestDeployment\target\repo\org\springframework\spring-webmvc\4.2.5.RELEASE\s
  pring-webmvc-4.2.5.RELEASE.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\springframework\s
  pring-expression\4.2.5.RELEASE\spring-expression-4.2.5.RELEASE.jar to C:\STS\wsR
  estTemplate\TestDeployment\target\repo\org\springframework\spring-expression\4.2
  .5.RELEASE\spring-expression-4.2.5.RELEASE.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\emb
  ed\tomcat-embed-core\8.0.32\tomcat-embed-core-8.0.32.jar to C:\STS\wsRestTemplat
  e\TestDeployment\target\repo\org\apache\tomcat\embed\tomcat-embed-core\8.0.32\to
  mcat-embed-core-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\emb
  ed\tomcat-embed-logging-juli\8.0.32\tomcat-embed-logging-juli-8.0.32.jar to C:\S
  TS\wsRestTemplate\TestDeployment\target\repo\org\apache\tomcat\embed\tomcat-embe
  d-logging-juli\8.0.32\tomcat-embed-logging-juli-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\emb
  ed\tomcat-embed-jasper\8.0.32\tomcat-embed-jasper-8.0.32.jar to C:\STS\wsRestTem
  plate\TestDeployment\target\repo\org\apache\tomcat\embed\tomcat-embed-jasper\8.0
  .32\tomcat-embed-jasper-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\emb
  ed\tomcat-embed-el\8.0.32\tomcat-embed-el-8.0.32.jar to C:\STS\wsRestTemplate\Te
  stDeployment\target\repo\org\apache\tomcat\embed\tomcat-embed-el\8.0.32\tomcat-e
  mbed-el-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\eclipse\jdt\core\
  compiler\ecj\4.4.2\ecj-4.4.2.jar to C:\STS\wsRestTemplate\TestDeployment\target\
  repo\org\eclipse\jdt\core\compiler\ecj\4.4.2\ecj-4.4.2.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-jasper\8.0.32\tomcat-jasper-8.0.32.jar to C:\STS\wsRestTemplate\TestDeployme
  nt\target\repo\org\apache\tomcat\tomcat-jasper\8.0.32\tomcat-jasper-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-servlet-api\8.0.32\tomcat-servlet-api-8.0.32.jar to C:\STS\wsRestTemplate\Te
  stDeployment\target\repo\org\apache\tomcat\tomcat-servlet-api\8.0.32\tomcat-serv
  let-api-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-juli\8.0.32\tomcat-juli-8.0.32.jar to C:\STS\wsRestTemplate\TestDeployment\t
  arget\repo\org\apache\tomcat\tomcat-juli\8.0.32\tomcat-juli-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-el-api\8.0.32\tomcat-el-api-8.0.32.jar to C:\STS\wsRestTemplate\TestDeployme
  nt\target\repo\org\apache\tomcat\tomcat-el-api\8.0.32\tomcat-el-api-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-api\8.0.32\tomcat-api-8.0.32.jar to C:\STS\wsRestTemplate\TestDeployment\tar
  get\repo\org\apache\tomcat\tomcat-api\8.0.32\tomcat-api-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-util-scan\8.0.32\tomcat-util-scan-8.0.32.jar to C:\STS\wsRestTemplate\TestDe
  ployment\target\repo\org\apache\tomcat\tomcat-util-scan\8.0.32\tomcat-util-scan-
  8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-util\8.0.32\tomcat-util-8.0.32.jar to C:\STS\wsRestTemplate\TestDeployment\t
  arget\repo\org\apache\tomcat\tomcat-util\8.0.32\tomcat-util-8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-jasper-el\8.0.32\tomcat-jasper-el-8.0.32.jar to C:\STS\wsRestTemplate\TestDe
  ployment\target\repo\org\apache\tomcat\tomcat-jasper-el\8.0.32\tomcat-jasper-el-
  8.0.32.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\org\apache\tomcat\tom
  cat-jsp-api\8.0.32\tomcat-jsp-api-8.0.32.jar to C:\STS\wsRestTemplate\TestDeploy
  ment\target\repo\org\apache\tomcat\tomcat-jsp-api\8.0.32\tomcat-jsp-api-8.0.32.j
  ar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\commons-fileupload\co
  mmons-fileupload\1.3.1\commons-fileupload-1.3.1.jar to C:\STS\wsRestTemplate\Tes
  tDeployment\target\repo\commons-fileupload\commons-fileupload\1.3.1\commons-file
  upload-1.3.1.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\commons-io\commons-io
  \2.2\commons-io-2.2.jar to C:\STS\wsRestTemplate\TestDeployment\target\repo\comm
  ons-io\commons-io\2.2\commons-io-2.2.jar
  [INFO] Installing artifact C:\Users\e049447\.m2\repository\javax\servlet\javax.s
  ervlet-api\3.0.1\javax.servlet-api-3.0.1.jar to C:\STS\wsRestTemplate\TestDeploy
  ment\target\repo\javax\servlet\javax.servlet-api\3.0.1\javax.servlet-api-3.0.1.j
  ar
  [INFO] Installing artifact C:\STS\wsRestTemplate\TestDeployment\target\embeddedA
  pp.jar to C:\STS\wsRestTemplate\TestDeployment\target\repo\com\mycompany\myapp\b
  atchs\AuthFileUpload\0.0.1-SNAPSHOT\AuthFileUpload-0.0.1-SNAPSHOT.jar
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 19.899 s
  [INFO] Finished at: 2016-03-07T13:50:14-06:00
  [INFO] Final Memory: 22M/123M
  [INFO] ------------------------------------------------------------------------
  
  C:\STS\wsRestTemplate\TestDeployment&gt;cd target
  
  C:\STS\wsRestTemplate\TestDeployment\target&gt;java -jar embeddedApp.jar
  Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
  Error: A JNI error has occurred, please check your installation and try again
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/catalina/L
  ifecycleException
          at java.lang.Class.getDeclaredMethods0(Native Method)
          at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
          at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
          at java.lang.Class.getMethod0(Class.java:3018)
          at java.lang.Class.getMethod(Class.java:1784)
          at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544
  )
          at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
  
  Caused by: java.lang.ClassNotFoundException: org.apache.catalina.LifecycleExcept
  ion
          at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 7 more
  
  C:\STS\wsRestTemplate\TestDeployment\target&gt;
  </code></pre>
  
  <p>Extra plugin added in pom</p>
  
  <pre><code>&lt;finalName&gt;embeddedApp&lt;/finalName&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;${maven.compiler.plugin.version}&lt;/version&gt;
                             &lt;configuration&gt;
                                    &lt;source&gt;${java.version}&lt;/source&gt;
                                    &lt;target&gt;${java.version}&lt;/target&gt;
                             &lt;/configuration&gt;
                       &lt;/plugin&gt;
  
  
                       &lt;plugin&gt;
                             &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                             &lt;artifactId&gt;appassembler-maven-plugin&lt;/artifactId&gt;
                             &lt;version&gt;1.10&lt;/version&gt;
                             &lt;configuration&gt;
                                    &lt;assembleDirectory&gt;target&lt;/assembleDirectory&gt;
                                    &lt;programs&gt;
                                           &lt;program&gt;
                                                  &lt;mainClass&gt;com.mycompany.myapp.batchs.TestDeployment.App&lt;/mainClass&gt;
                                                  &lt;name&gt;App&lt;/name&gt;
                                           &lt;/program&gt;
                                    &lt;/programs&gt;
                             &lt;/configuration&gt;
                             &lt;executions&gt;
                                    &lt;execution&gt;
                                           &lt;phase&gt;package&lt;/phase&gt;
                                           &lt;goals&gt;
                                                  &lt;goal&gt;assemble&lt;/goal&gt;
                                           &lt;/goals&gt;
                                    &lt;/execution&gt;
                             &lt;/executions&gt;
                       &lt;/plugin&gt;
  
                       &lt;plugin&gt;
                             &lt;!-- Build an executable JAR --&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;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                                                  &lt;mainClass&gt;com.mycompany.myapp.batchs.TestDeployment.App&lt;/mainClass&gt;
                                           &lt;/manifest&gt;
                                    &lt;/archive&gt;
                             &lt;/configuration&gt;
                       &lt;/plugin&gt;
  
                &lt;/plugins&gt;
  </code></pre>