title: How to run tomcat7-maven-plugin, that server code changes will be updated immediately
body: <p>I have project in maven. Here is main <code>pom.xml</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><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;groupId&gt;pl.derp&lt;/groupId&gt;
      &lt;artifactId&gt;parent&lt;/artifactId&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;modules&gt;
          &lt;module&gt;server&lt;/module&gt;
          &lt;module&gt;shared&lt;/module&gt;
          &lt;module&gt;web&lt;/module&gt;
      &lt;/modules&gt;
  
      &lt;properties&gt;
          &lt;gwtVersion&gt;2.7.0&lt;/gwtVersion&gt;
          &lt;webappDirectory&gt;${project.build.directory}/${project.build.finalName}&lt;/webappDirectory&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;tomcat.webport&gt;8083&lt;/tomcat.webport&gt;
          &lt;tomcat.ajpport&gt;8182&lt;/tomcat.ajpport&gt;
          &lt;tomcat.context&gt;/parent&lt;/tomcat.context&gt;
  
          &lt;hibernate.version&gt;4.3.7.Final&lt;/hibernate.version&gt;
          &lt;mysql.connector.version&gt;5.1.21&lt;/mysql.connector.version&gt;
  
          &lt;slf4j.version&gt;1.6.4&lt;/slf4j.version&gt;
          &lt;spring.version&gt;3.0.5.RELEASE&lt;/spring.version&gt;
          &lt;guice.version&gt;3.0&lt;/guice.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.gwt&lt;/groupId&gt;
              &lt;artifactId&gt;gwt-servlet&lt;/artifactId&gt;
              &lt;version&gt;${gwtVersion}&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.gwt&lt;/groupId&gt;
              &lt;artifactId&gt;gwt-user&lt;/artifactId&gt;
              &lt;version&gt;${gwtVersion}&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.GA&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.GA&lt;/version&gt;
              &lt;classifier&gt;sources&lt;/classifier&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;!-- DB related dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;${mysql.connector.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
              &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;3.12.1.GA&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;version&gt;1.4.182&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Logging --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;${slf4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;version&gt;${slf4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Custom formats --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;joda-time&lt;/groupId&gt;
              &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jadira.usertype&lt;/groupId&gt;
              &lt;artifactId&gt;usertype.extended&lt;/artifactId&gt;
              &lt;version&gt;3.2.0.GA&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- Spring --&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;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&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;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-taglibs&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- Tests --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.10&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  
      &lt;build&gt;
  
          &lt;defaultGoal&gt;clean install tomcat7:run-war-only&lt;/defaultGoal&gt;
  
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;gwt-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${gwtVersion}&lt;/version&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3&lt;/version&gt;
              &lt;/plugin&gt;
  
              &lt;!-- IDE --&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.7&lt;/version&gt;  &lt;!-- Note 2.8 does not work with AspectJ aspect path --&gt;
                  &lt;configuration&gt;
                      &lt;downloadSources&gt;true&lt;/downloadSources&gt;
                      &lt;downloadJavadocs&gt;false&lt;/downloadJavadocs&gt;
                      &lt;wtpversion&gt;2.0&lt;/wtpversion&gt;
                      &lt;additionalBuildcommands&gt;
                          &lt;buildCommand&gt;
                              &lt;name&gt;org.eclipse.jdt.core.javabuilder&lt;/name&gt;
                              &lt;arguments&gt;
                              &lt;/arguments&gt;
                          &lt;/buildCommand&gt;
                          &lt;buildCommand&gt;
                              &lt;name&gt;com.google.gdt.eclipse.core.webAppProjectValidator&lt;/name&gt;
                              &lt;arguments&gt;
                              &lt;/arguments&gt;
                          &lt;/buildCommand&gt;
                          &lt;buildCommand&gt;
                              &lt;name&gt;com.google.gwt.eclipse.core.gwtProjectValidator&lt;/name&gt;
                              &lt;arguments&gt;
                              &lt;/arguments&gt;
                          &lt;/buildCommand&gt;
                      &lt;/additionalBuildcommands&gt;
                      &lt;additionalProjectnatures&gt;
                          &lt;projectnature&gt;com.google.gwt.eclipse.core.gwtNature&lt;/projectnature&gt;
                      &lt;/additionalProjectnatures&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&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;2.5.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;path&gt;${tomcat.context}&lt;/path&gt;
                      &lt;port&gt;${tomcat.webport}&lt;/port&gt;
                      &lt;ajpPort&gt;${tomcat.ajpport}&lt;/ajpPort&gt;
                      &lt;systemProperties&gt;
                          &lt;JAVA_OPTS&gt;-XX:MaxPermSize=256m&lt;/JAVA_OPTS&gt;
                      &lt;/systemProperties&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I am using <code>tomcat7-maven-plugin</code> as You can see in pom.xml.</p>
  
  <p>To start server I use command: <code>maven clean install tomcat7:run-war-only</code></p>
  
  <p>But unfortunately when I do any change in <strong>server side/tier code</strong> I have to stop server and run it again, which takes a lot of time, cause of: test runs, full compilation, all permutation compilation (it is gwt app, so it compiles java code to js code for each web browser)...</p>
  
  <p>How can I set up auto code replace/hot swap on runtime, that I don't have to restart and recompile my project, when I do one little change?</p>
  
  <p>I would speed up my developing process.</p>
  
  <p>Please give me some help.</p>