ses
ses

Reputation: 13342

Triggering tomcat to update a project on compile when resource or code is changed in Intellij IDEA

I use intellij IDEA (12.x).

There is Spring MVC app under Tomcat 6. This is what I'm going to do:

My steps:

 1. Run idea
 2. Create new project -> Spring MVC application

Everything configuring now to run application.

 3. Start application (pressing green arrow on the top), 
    As a result I can see my "hello" message jsp - in browser

 4. in the Controller I change "hello" to "hello123"

Then I want to see my "hello123" in the browser page. My tries:

 5. refresh page - no result
 6. Ctrl+Shift+F9 (compiling current controller class). 
    refresh page - no result
 7. pressing "refresh" button in the tomcat server panel in IDEA. 
    the pop-up dialog appears: "update classes and resuources" option 
    is selected there by default. refresh page - no result
 8. restart server - then yes - I can see result ("hello123" message)

What is the best way to minimize the actions/wait time to get the result as fast as possible to safe developer time?

In my tomcat-configuration panel, I have the following configuration (they are came by default, actually):

On 'Update' action: Update classes and resources.
On frame deactivation: Do nothing

Before launch: Make; Build app:war exploded artifact

Upvotes: 0

Views: 1044

Answers (1)

Makoto
Makoto

Reputation: 106440

There's two parts to this - JSP compilation and source file compilation. In my experience, IDEA is fine with reloading resources and classes with some limitations, but to truly minimize the time you have between compiling and seeing it live, you'll need a third-party tool - JRebel.

To get to the reloading of resources, here's what you can do.

  • While Tomcat is running, when you make a change, hit the blue refresh icon.
  • When it pops up, select "Reload classes and resources".
  • Your classes and resources should be reloaded.

What JRebel will give you is pretty well listed here, as opposed to just reloading the resources every time using the JVM Hot Swap.

Upvotes: 1

Related Questions