JRebel not listening or reloading changes in src/main/resources directory making reading such files return cached and invalid value.
Is this normal?
JRebel not listening or reloading changes in src/main/resources directory making reading such files return cached and invalid value.
Is this normal?
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
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...)
In case you are using IntelliJ IDEA try "Make Project" under "Build" tab or by pressing Ctrl+F9.
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
target/classes
instead of /path_to_project_root/target/classes
–
Brasca Make sure your project doesn´t have any compilation error in eclipse.
Also check your JDK Compliance. I had the wrong version and my target/classes files were not updated.
If the target/classes content is not updated, jrebel won´t see any changes.
Simply, add root path to rebel.xml
inside classpath
as named dir
with exactly path.
For example My project have classes and also resource files under java dir, so I setted as:
<?xml version="1.0" encoding="UTF-8"?>
<application generated-by="intellij" 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_3.xsd">
<id>$your project id$</id>
<classpath>
<dir name="$yourProjectPath$/out/production/resources">
</dir>
<dir name="$yourProjectPath$/src/java/">
</dir>
<dir name="$yourProjectPath$/out/production/classes">
</dir>
</classpath>
</application>
I have used something like that and it worked for me. JRebel plugin needs to be installed on IDEA or you can use plugin in pom.xml
Note 1: rebel.xml file was automatically generated by JRebel plugin on IDEA into src/main/resources, so that there is not needed jrebel plugin to be added into pom.xml
Note 2: Don't forget to keep slash in the path, not backslash! ;)
<?xml version="1.0" encoding="UTF-8"?>
<application 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="C:/myWorkspace/myWar/target/classes"></dir>
</classpath>
<web>
<link target="/">
<dir name="C:/myWorkspace/myWar/src/main/webapp"></dir>
</link>
</web>
</application>
Another option is to refer to target/generated-webapp with following config in jrebel.xml
<web>
<link target="/">
<dir name="/path_to_project_root/target/generated-webapp/resources">
<exclude name="/"/>
</dir>
</link>
<link target="/">
<dir name="/path_to_project_root/src/main/webapp">
</dir>
</link>
</web>
add maven resources plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-webapp/resources</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/webapp/resources</directory>
<includes>
<include>**/*.css</include>
<include>**/*.js</include>
</includes>
<excludes>
<exclude></exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
© 2022 - 2024 — McMap. All rights reserved.
target/classes
instead of/path_to_project_root/target/classes
– Brasca