Exploded War deployment with IntelliJ Idea, Maven, Tomcat and JRebel

17,326

Solution 1

After you've configured it properly, when you're starting Tomcat, you should see something like this:

[2013-01-23 15:39:12] JRebel: Directory '/home/xxx/workspace/xxx/trunk/target/classes' will be monitored for changes.
[2013-01-23 15:39:12] JRebel: Directory '/home/xxx/workspace/xxx/trunk/src/main/webapp' will be monitored for changes.

Then what I do is each time I change something, instead of running maven package, I perform "Make project" (in IDEA), /target/classes folder gets updated and configuration will reload its classes automatically.

Solution 2

Do you have the IntelliJ IDEA JRebel plug-in installed? It adds an action "Generate rebel.xml". This will generate a rebel.xml file, which should end up in WEB-INF/classes in the deployment, and that will map the classes to the location where IDEA compiles them.

Share:
17,326
Hung Tran
Author by

Hung Tran

I like TypeScript and AWS.

Updated on June 05, 2022

Comments

  • Hung Tran
    Hung Tran 12 months

    I'm developing a web-based application with IntelliJ Idea 12, Maven, JRebel and Tomcat. In order to take advantage of JRebel, automatically reloading changes to Spring beans, I used the exploded war deployment provided by Intellij below

    IntelliJ exploded war deployment

    Due to a Maven module, IntelliJ exactly followed Maven's convention to compile Java files into the output folder (target/classes) which is DIFFERENT to the exploded webapp directoy (target/spring-mvc-showcase/webapp/web-inf/classes). As a result, Tomcat and JRebel can't reload changes of these new classes.

    At the moment, I temporarily configured IntelliJ's output folder pointed to the folder WEB-INF/classes so that changes could be reloaded. As I don't want to break Maven conventions, could anyone tell me a more elegant solution?

    target (Maven generated artifact directory)
      |
       -- classes (compiled)
      |
       -- spring-mvc-showcase (exploded webapp directory)
               |
                -- WEB-INF
                     |
                       -- classes
    
  • Hung Tran
    Hung Tran over 10 years
    Your log is very useful, it helped me understand my JRebel configuration was wrong.
  • ag0rex
    ag0rex over 10 years
    I kinda had the same issue. Actually, it's maven who keeps the exploded war at target/spring-mvc-showcase, so if you point JRebel to /target/spring-mvc-showcase/WEB-INF/classes, you'll have to run maven each time you change a class. Instead, if you point it to watch target/classes, you get away with a "Make project", which is faster.
  • Hung Tran
    Hung Tran over 10 years
    Thanks a lot. I didn't know there was one tutorial left for "rebel.xml". After installing JRebel plugin for IntelliJ, I thought it worked as I saw it perfectly reloaded changes in Spring XML configurations.