IDEA编辑器中Maven项目target/classes目录下不存在mapper.xml 映射文件

在使用IntelliJ IDEA(IDEA)进行Maven项目开发时,开发者发现target/classes目录下缺少mapper.xml文件,这可能导致MyBatis无法正常工作。解决这个问题通常涉及检查pom.xml配置,确保编译过程包含mapper文件,并确保IDEA的构建设置正确。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 <!--解决IDEA构建项目时,target/classes目录下不存在mapper.xml 映射文件-->
 <!-- 第一种-->
    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
            </resource>
        </resources>
    </build>
     <!-- 第二种-->
	 <build>
        <resources>
            <resource>
                <directory>${basedir}/src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>
"D:\java\IntelliJ IDEA 2019.2.4\jbr\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\java\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar=50476:D:\java\IntelliJ IDEA 2019.2.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\java\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar;D:\java\IntelliJ IDEA 2019.2.4\plugins\junit\lib\junit-rt.jar;D:\java\IntelliJ IDEA 2019.2.4\plugins\junit\lib\junit5-rt.jar;D:\java\ljj-di4\target\test-classes;D:\java\ljj-di4\target\classes;D:\MavenRepository\org\mybatis\mybatis\3.5.2\mybatis-3.5.2.jar;D:\MavenRepository\mysql\mysql-connector-java\8.0.11\mysql-connector-java-8.0.11.jar;D:\MavenRepository\com\google\protobuf\protobuf-java\2.6.0\protobuf-java-2.6.0.jar;D:\MavenRepository\junit\junit\4.12\junit-4.12.jar;D:\MavenRepository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 Test1,testUpdateById Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter. PooledDataSource forcefully closed/removed all connections. PooledDataSource forcefully closed/removed all connections. PooledDataSource forcefully closed/removed all connections. PooledDataSource forcefully closed/removed all connections. Opening JDBC Connection Created connection 363509958. Setting autocommit to false on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@15aab8c6] ==> Preparing: update ms_member set uname = ?, password = ?, email = ?, sex = ?, mobile = ? where member_id = ? org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'email' in 'class com.itheima.pojo.Member' ### The error may exist in com/itheima/mapper/MemberDaoMapper.xml ### The error may involve com.itheima.mapper.MemberDaoMapper.updateById-Inline ### The error occurred while setting parameters ### SQL: update ms_member set uname = ?, password = ?, email = ?, sex = ?, mobile = ? where member_id = ? ### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'email' in 'class com.itheima.pojo.Member' at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:67) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:57) at com.sun.proxy.$Proxy7.updateById(Unknown Source) at Test1.testUpdateById(Test1.java:63) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'email' in 'class com.itheima.pojo.Member' at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:371) at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:163) at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162) at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49) at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122) at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:79) at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:94) at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:87) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ... 26 more Process finished with exit code -1 这个是什么错误
最新发布
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值