Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JRebel not listening or reloading changes in src/main/resources directory

Tags:

jrebel

JRebel not listening or reloading changes in src/main/resources directory making reading such files return cached and invalid value.

Is this normal?

like image 360
mjs Avatar asked Aug 30 '14 15:08

mjs


2 Answers

Make sure that the directory is listed in rebel.xml configuration file that is deployed with the app. If your rebel.xml was generated with JRebel plugin for Maven, then just make sure you specify that you want the resources directory to be included into the configuration:

<addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>  

If you're using IntelliJ IDEA, and you don't see the changes applied to the resources, then you probably haven't configured the IDE to copy the files from resources directory to the target directory. Or mark the resources directory as "resources" directory (Right click on the folder in the project tree -> Mark directory as...)

like image 76
Anton Arhipov Avatar answered Oct 11 '22 12:10

Anton Arhipov


I've had the same issue, and reading the manual i found a solution that works for me.

I'm using a JSF project with Spring 3, with netbeans and running jrebel via IDE

Notice that the comments were things that i have tried previously, it doesn't means that won't work.

The important thing here is the addition of resource path into classpath and the elimination of the link tag that jrebel puts automatically into the web node.

rebel.xml:

<application generated-by="netbeans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.zeroturnaround.com" 
    xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">

<classpath>
    <!--<dir name="/path_to_project_root/target/classes"></dir>-->
    <dirset dir="/path_to_project_root/">
        <include name="**/target/classes"/>
        <include name="**/src/main/resources"/>
    </dirset> 
    </classpath>

    <web>
    <!--<link target="/">-->
        <dir name="/path_to_project_root/src/main/webapp"></dir> 
        <dir name="/path_to_project_root/src/main/resources"></dir> 
    <!--</link>-->
    </web>

</application>

Also i configured the plugin in the pom.xml, setting the property addResourcesDirToRebelXml to true

pom.xml:

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

source: https://manuals.zeroturnaround.com/jrebel/standalone/advanced-config.html

like image 25
wiggin200 Avatar answered Oct 11 '22 13:10

wiggin200