JRebel 不检测多个 webapp 文件夹上的 web 资源更改
JRebel do not detect web resource changes over multiple webapp folders
我有一个模块化的 Web 项目,因此我允许模块成为 war 存档,包括 webapp 文件夹。使用以下 rebel.xml 可以很好地检测所有模块的 class 变化。但是由于某些原因,jrebel 在 html 或 js 更改时不会移动。
<?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://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<!-- appserver -->
<dir name="/home/xx/data/appserver/target/classes/main"/>
<dir name="/home/xx/data/appserver/target/resources/main"/>
<!-- module -->
<dir name="/home/xx/data/as.module.core/target/classes/main"/>
<dir name="/home/xx/data/as.module.core/target/resources/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/classes/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/resources/main"/>
</classpath>
<!-- web>
<link target="/">
<dir name="/home/xx/data/appserver/src/main/webapp"/>
<dir name="/home/xx/data/as.module.core/src/main/webapp"/>
<dir name="/home/xx/data/as.module.mqlcore/src/main/webapp"/>
</link>
</web -->
<web>
<link target="/">
<dirset dir="/home/xx/data">
<include name="**/src/main/webapp"/>
</dirset>
</link>
</web>
</application>
编辑:
有趣的是。当我使用 web 配置的注释部分时,所有三个 webapp 文件夹都在日志中,并将被监视以进行更改。但是应用服务器找不到所有的webapp文件。当我使用第二个 <web>
配置时,应用程序服务器可以看到所有文件,但 jrebel 不会观察到。我认为不可能有多个目录链接到“/”
每个模块,例如 .war 或 .jar 文件都需要有自己的 rebel.xml 文件。否则它们都会重新加载相同的资源,并且当有不同的类加载器时,可能会发生各种奇怪的事情。
可以通过从 jrebel.log 中搜索 "found resource" 来检查 JRebel 实际使用的文件实例。应该这样写
sun.misc.Launcher$AppClassLoader@184be29 找到资源:'cfg/log4j.xml' 来自 'file:/C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'。
还可以通过使用 Event 查找行来查看哪个文件发生了更改,如下所示:
[IntelliJFSNotify] 事件 'CHANGE' 于:'C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'
如果不重新加载文件,通常发现资源和更改的文件路径不匹配。如果它们确实匹配,那么建议将文件的绝对路径和 jrebel.log 发送到 support@zeroturnaround.com 以进行调查。
好的,答案是:<web><link target="/"></link></web>
配置下确实不能配置多个目录。我现在有一个文件夹 ./target/all-webapp ,我在其中通过 gradle 任务 smylink (cp -sR
) 所有文件...不是很好但可以工作...感谢上帝 jrebel 正在跟踪符号链接!
我有一个模块化的 Web 项目,因此我允许模块成为 war 存档,包括 webapp 文件夹。使用以下 rebel.xml 可以很好地检测所有模块的 class 变化。但是由于某些原因,jrebel 在 html 或 js 更改时不会移动。
<?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://www.zeroturnaround.com/alderaan/rebel-2_0.xsd">
<classpath>
<!-- appserver -->
<dir name="/home/xx/data/appserver/target/classes/main"/>
<dir name="/home/xx/data/appserver/target/resources/main"/>
<!-- module -->
<dir name="/home/xx/data/as.module.core/target/classes/main"/>
<dir name="/home/xx/data/as.module.core/target/resources/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/classes/main"/>
<dir name="/home/xx/data/as.module.mqlcore/target/resources/main"/>
</classpath>
<!-- web>
<link target="/">
<dir name="/home/xx/data/appserver/src/main/webapp"/>
<dir name="/home/xx/data/as.module.core/src/main/webapp"/>
<dir name="/home/xx/data/as.module.mqlcore/src/main/webapp"/>
</link>
</web -->
<web>
<link target="/">
<dirset dir="/home/xx/data">
<include name="**/src/main/webapp"/>
</dirset>
</link>
</web>
</application>
编辑:
有趣的是。当我使用 web 配置的注释部分时,所有三个 webapp 文件夹都在日志中,并将被监视以进行更改。但是应用服务器找不到所有的webapp文件。当我使用第二个 <web>
配置时,应用程序服务器可以看到所有文件,但 jrebel 不会观察到。我认为不可能有多个目录链接到“/”
每个模块,例如 .war 或 .jar 文件都需要有自己的 rebel.xml 文件。否则它们都会重新加载相同的资源,并且当有不同的类加载器时,可能会发生各种奇怪的事情。
可以通过从 jrebel.log 中搜索 "found resource" 来检查 JRebel 实际使用的文件实例。应该这样写 sun.misc.Launcher$AppClassLoader@184be29 找到资源:'cfg/log4j.xml' 来自 'file:/C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'。
还可以通过使用 Event 查找行来查看哪个文件发生了更改,如下所示: [IntelliJFSNotify] 事件 'CHANGE' 于:'C:/Projects/testproject/Trunk/edm/target/cfg/log4j.xml'
如果不重新加载文件,通常发现资源和更改的文件路径不匹配。如果它们确实匹配,那么建议将文件的绝对路径和 jrebel.log 发送到 support@zeroturnaround.com 以进行调查。
好的,答案是:<web><link target="/"></link></web>
配置下确实不能配置多个目录。我现在有一个文件夹 ./target/all-webapp ,我在其中通过 gradle 任务 smylink (cp -sR
) 所有文件...不是很好但可以工作...感谢上帝 jrebel 正在跟踪符号链接!