首页 > 代码库 > IntelliJ IDEA通过maven构建ssm项目找不到mapper

IntelliJ IDEA通过maven构建ssm项目找不到mapper

idea运行ssm项目的时候一直报错

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

原因:  部署后target里面没有mybatis的配置文件*.xml

解决方法:在pom.xml中通过maven强制将*.xml文件一起发布

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

 技术分享

IntelliJ IDEA通过maven构建ssm项目找不到mapper