'idea Invalid bound statement (not found)

i am using idea 2021, i have a spring boot project with maven and mybatis.

i often encounter this problem:

once I modify the mybatis sql xml file(e.g. booking.xml), then I redeploy this project(I have to redeploy such that make the modification under src/main/resource effect).

After that, error Invalid bound statement (not found): xxx throw if i access the sql which in the modification sql xml file(e.g. I modified content of updateBooking, it will say invalid bound statment(not found): selectBooking). I am pretty sure the bound statement is exist in this sql xml file and all works before modifying.

I checked the target of this idea project and found that there is no booking.xml file, it seems that this sql xml file is deleted from target after I modified it and redeploy.

In order to solve it, I need to run mvn clean package for this project then redeploy it.

it seems that this happen in idea, i didn't encounter it in eclipse before.

How can i fix this problem permanently?

enter image description here



Solution 1:[1]

  1. I use the following configuration every time I have this problem.

     <resources>
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.xml</include>
    ....
                    </includes>
                </resource>
            </resources>
    
  2. mvn clean package.

  3. restart IDEA.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PFyyh