SweetInk / jrebel-mybatisplus-idea-plugin

JRebel MybatisPlus hot reloading extension for IntelliJ
Apache License 2.0
23 stars 1 forks source link

mapper.xml无法热部署 #3

Closed sa-yuki closed 2 years ago

sa-yuki commented 2 years ago

spring-boot - 2.3.4.RELEASE mybatis-plus-boot-starter - 3.4.2

安装了JRebel和JRebel mybatisPlus extension插件

class正常热部署,mapper.xml无法热部署,需要重新编译

SweetInk commented 2 years ago

我测试了可以热部署 你启动项目有如下日志输出吗

JRebel: Ready config JRebel MybatisPlus plugin...
JRebel: Add CBP for mybatis-plus core classes...
sa-yuki commented 2 years ago

我测试了可以热部署 你启动项目有如下日志输出吗

JRebel: Ready config JRebel MybatisPlus plugin...
JRebel: Add CBP for mybatis-plus core classes...

有的,但是多一个添加特殊CBPs的提示

JRebel: Ready config JRebel MybatisPlus plugin... JRebel: Add CBP for mybatis-plus core classes... JRebel: Detected mybatis-plus version is v3.4.0+, add special CBPs...

SweetInk commented 2 years ago

改了mapper.xml后重新请求接口有没有输出这个JRebel: Reloading SQL maps

SweetInk commented 2 years ago

看看你的Configurationimage

sa-yuki commented 2 years ago

改了mapper.xml后重新请求接口有没有输出这个JRebel: Reloading SQL maps

没有输出这个

sa-yuki commented 2 years ago

看看你的Configurationimage

image 我的Configurations貌似和你的不一样

SweetInk commented 2 years ago

你改了xml后可以试试CTRL+SHIFT+F9,

SweetInk commented 2 years ago

我用的IDEA 2021.2.4版本

sa-yuki commented 2 years ago

你改了xml后可以试试CTRL+SHIFT+F9,

改了XML之后按CTRL+SHIFT+F9会提示Loaded classes are up to date. Nothing to reload.

sa-yuki commented 2 years ago

我用的IDEA 2021.2.4版本

我的是2021.3.2版本

SweetInk commented 2 years ago

你改了xml后可以试试CTRL+SHIFT+F9,

改了XML之后按CTRL+SHIFT+F9会提示Loaded classes are up to date. Nothing to reload.

在xml编辑窗口的左下角应该有这个提示File 'testMapper.xml' has been packaged at 4:59:20 下午.

sa-yuki commented 2 years ago

我这边并没有这个提示,我换和你一个版本的IDEA试试

sa-yuki commented 2 years ago

image 看样子是IDEA新版本移除了Configuration中的Spring Boot配置

sa-yuki commented 2 years ago

已经修改了Configuration,还是无法热部署,左下角一直提示Loaded classes are up to date. Nothing to reload.

SweetInk commented 2 years ago

On 'Update' action: Update classes and resources

sa-yuki commented 2 years ago

On 'Update' action: Update classes and resources

image 配置了这个,修改xml后按CTRL+SHIFT+F9提示Loaded classes are up to date. Nothing to reload.

SweetInk commented 2 years ago

image

理论上你改了xml后,你的project/target 下会有最新修改后的xml,JRebel扫描的文件也是这个目录下的

sa-yuki commented 2 years ago

Desktop Screenshot 2022 03 16 - 17 51 41 89 我这边target下的xml并没有被更新

sa-yuki commented 2 years ago

方便发一下你的测试项目吗,我看看是否有配置上的不同

SweetInk commented 2 years ago

方便发一下你的测试项目吗,我看看是否有配置上的不同

https://wwb.lanzoub.com/iScU901jymcj

sa-yuki commented 2 years ago

方便发一下你的测试项目吗,我看看是否有配置上的不同

https://wwb.lanzoub.com/iScU901jymcj

我这边mapper文件没有放在resources下,是这个问题吗

sa-yuki commented 2 years ago

我的mapper是放在mapper/xml下的 image

sa-yuki commented 2 years ago

image 我把mapper放到resources下就可以热部署了,在mapper/xml下有办法热部署吗

SweetInk commented 2 years ago

你指的是src/main/java下的mapper package吗,如果是的话,尝试在你的pom.xml里添加如下代码

 <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>
sa-yuki commented 2 years ago

你指的是src/main/java下的mapper package吗,如果是的话,尝试在你的pom.xml里添加如下代码

 <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

感谢,可以正常热部署了