Incremental hot deployment on Tomcat with Maven and NetBeans
Asked Answered
P

4

9

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?

Palanquin answered 3/5, 2010 at 8:28 Comment(0)
B
1

Take a look at JRebel. It should do what you want. Painlessly.

Bock answered 29/1, 2014 at 12:29 Comment(0)
P
0

Have a look at Hot Deployment of a Web Application with Maven in NetBeans. I also suggest to check Glassfish Hot Code Re-deployment (on Maven), especially the post about Compile on Save, and to try GlassFish, you may get better results.

Platt answered 3/5, 2010 at 8:44 Comment(1)
I have the same behaviour on GlassFish. The only thing happened is that I cannot select "Tomcat" in the project settings after my GlassFish trial :-(Palanquin
U
0

Use the tomcat:inplace goal to invoke your webapp from its compiled classes and sources.

You may experience file locking problems on Windows. There are several workarounds, such as the antiJarLocking contet attribute, but essentially this boils down to your webapp not properly shutting down, whch will eventually exhaust your VMs memory after several reloads. In my case, I was using Spring, and the "proper" fix was to add a destroy-method on some key beans so that the app was gracefully shutdown.

Maven Tomcat Plugin - tomcat:inplace

Upali answered 3/5, 2010 at 8:46 Comment(0)
M
0

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.

Marcille answered 4/8, 2010 at 22:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.