Koray Tugay
Koray Tugay

Reputation: 23800

JRebel with maven for Java Web App requires clean install everytime, is this right?

So I am using JRebel but I think there is something wrong currently with how I use it.

This is in my pom.xml:

<plugin>
    <groupId>org.zeroturnaround</groupId>
    <artifactId>jrebel-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>generate-rebel-xml</id>
            <phase>process-resources</phase>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

And when I deploy the app I read:

2014-08-03 15:43:42 JRebel: Directory '/Users/koraytugay/IdeaProjects/august-three/target/classes' will be monitored for changes.
2014-08-03 15:43:42 JRebel: Directory '/Users/koraytugay/IdeaProjects/august-three/src/main/webapp' will be monitored for changes.

I must say that I am working with IntelliJ and the server I am using is Tomcat.

I have a simple Java Code that gets invoked when I hit index.jsp:

public static int rollDice() {
        return 11;
}

When I change the value 11 to 9 and refresh index.jsp I do not see the change. I must do a clean install in maven and then JRebel will work.

Is there any way to do this without maven clean install? When I edit the source file, can I directly see the change in my web-app?

Thanks.

Upvotes: 1

Views: 398

Answers (1)

Jakub Kubrynski
Jakub Kubrynski

Reputation: 14149

You just have to compile the single file you've changed. JRebel is tracking all classes and it'll reload changed class during next access. To do that in IntelliJ you need to invoke Build -> Compile from menu or use proper shortcut of course (Ctrl + Shift + F9). Also from IntelliJ 12 you can just check option "Make project automatically" in Settings -> Compiler to automatically compile all edited files)

Upvotes: 3

Related Questions