title: spring boot maven how to build both war and jar file
body: <p>Hello I need to know how to build both war and jar file in one time by mavan install</p>
  
  <p>I need to use war file for deploy on google app engine and jar file for execute on jenkin by command (java -jar ....)</p>
  
  <p>this is pom.xml file</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;org.demo&lt;/groupId&gt;
  &lt;artifactId&gt;gae-demo&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.1.0.BUILD-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-legacy&lt;/artifactId&gt;
          &lt;version&gt;1.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.kindleit&lt;/groupId&gt;
          &lt;artifactId&gt;gae-runtime&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;appengine-api-labs&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;appengine-api-stubs&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;appengine-testing&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt; 
  &lt;properties&gt;
      &lt;start-class&gt;demo.Application&lt;/start-class&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;java.version&gt;1.7&lt;/java.version&gt;
      &lt;m2eclipse.wtp.contextRoot&gt;/&lt;/m2eclipse.wtp.contextRoot&gt;
      &lt;gae.version&gt;1.8.8&lt;/gae.version&gt;
      &lt;gae.home&gt;${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version}&lt;/gae.home&gt;
      &lt;gae.application.version&gt;test&lt;/gae.application.version&gt;
  &lt;/properties&gt;
  &lt;build&gt;
      &lt;plugins&gt;
      ...
         &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;deploy&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;deploy-file&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;packaging&gt;jar&lt;/packaging&gt;
                          &lt;generatePom&gt;true&lt;/generatePom&gt;
                          &lt;url&gt;${project.distributionManagement.repository.url}&lt;/url&gt;
                          &lt;artifactId&gt;${project.artifactId}&lt;/artifactId&gt;
                          &lt;groupId&gt;${project.groupId}&lt;/groupId&gt;
                          &lt;version&gt;${project.version}&lt;/version&gt;
                          &lt;file&gt;${project.build.directory}/${project.artifactId}-${project.version}.jar&lt;/file&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          ...
  </code></pre>
  
  <p>this pom.xml can create war and jar file but if I try to execute jar file by this command java -jar ... 
  it's show the error </p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org.springframework/boot/SpringApplication
  </code></pre>