Incremental hot deployment on Tomcat with Maven and NetBeans

deamon picture deamon · May 3, 2010 · Viewed 9.8k times · Source

I'm using NetBeans 6.8, Tomcat 6, and Maven 2.2 and want to see changes in my code immediately in the browser (showing http://localhost:8080) after saving the file.

The tomcat-maven-plugin has the following configuration:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <version>1.0-beta-1</version>
</plugin>

Following to the output it should perform in-place deployment.

What can I do to see changes in my Java code immediately in the browser?

Answer

Amala picture Amala · Aug 5, 2010

I spent a lot of time trying to get this work. Finally I just used jetty. I put this:

   <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>${jetty.version}</version>
            <configuration>
                <reload>automatic</reload>
                <scanIntervalSeconds>5</scanIntervalSeconds>
            </configuration>
   </plugin>

Maybe all parameters are not correct, but then I created a custom goal of 'jetty:run' And I use that. I can't use the big green play button 'Run', but the jetty deploy works nicely and it hot deploys any changes in the Java classes.