maven build resources
1、在我用springboot+mytatis时,生成完mapper后,然后访问网站总是报错

错误信息:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.insurance.repository.MOperateLogMapper.selectByExample] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.insurance.repository.MOperateLogMapper.selectByExample
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
at com.sun.proxy.$Proxy64.selectByExample(Unknown Source)
at com.insurance.services.impl.OperateLogService.getDataGridDataByCondition(OperateLogService.java:37)
at com.insurance.backend.controller.LogOperateController.getDataGridDataByCondition(LogOperateController.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
经过排查,发现是classpath(即表示target下的classses文件夹)下,没有生成mapper.xml


2、解决,在repository项目的pom文件中,加上build resources即可,如图

生成结果

最后要想能运行,还要配置MapperScan的扫描基础包

3、延伸
(1)、filtering


我自己实践中的一个例子:

当此filtering为true时,结果竟是



这表明,当设置了filtering为true时,<directory>src/main/resources</directory>文件夹下的文件,如某些js呀等等,可能被application.yml中配置的某些变量替代了

所以,没有特别需求, 应该不对build-resources下的<directory>src/main/resources</directory>进行设置;或者如果进行设置,让filtering为false最好
(2)、pom文件中的,build-resources,如果不进行特殊设置,默认会按如下图描述方式;

对<directory>src/main/resources</directory>来说,如果进行了设置,就会按照设置的进行,例:

对<directory>src/main/java</directory>来说,即使进行了设置(当然是不进行排除.class文件设置),也会把默认的编译后.class文件放到classpath中

maven build resources的更多相关文章
- maven pom 中的 build——resources 标签 mybatis加载mapper类及.xml文件
转: maven 理解 2017年12月18日 15:34:31 feicongcong 阅读数:5658 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn ...
- Java 在pom.xml中配置build resources, 来防止我们资源导出失败问题(Maven项目)
在pom.xml中配置build, 来防止我们资源导出失败问题 <!--在build中配置resources, 来防止我们资源导出失败问题--> <build> <res ...
- maven:log4j:WARN No appenders could be found for logger (loggerInfo).或者maven build error:org.apache.maven.lifecycle.LifecycleExecutionExceptio
maven在build构建时,加载资源文件时需要配置资源文件插件: 1,在pom.xml文件中加入 <build> <finalName>${project.build.tar ...
- Maven Build profiles
They modify the POM at build time, and are meant to be used in complementary sets to give equivalent ...
- Maven Build Profiles--reference
What is Build Profile? A Build profile is a set of configuration values which can be used to set or ...
- 利用maven的resources、filter和profile实现不同环境使用不同配置文件
基本概念说明(resources.filter和profile): 1.profiles定义了各个环境的变量id 2.filters中定义了变量配置文件的地址,其中地址中的环境变量就是上面profil ...
- Maven Build Life Cycle--reference
What is Build Lifecycle? A Build Lifecycle is a well defined sequence of phases which define the ord ...
- 利用maven中resources插件的copy-resources目标进行资源copy和过滤
maven用可以利用如下配置进行资源过滤,pom.xml的配置如下: <build> <!-- 主资源目录 --> <resources> <resource ...
- maven build pulgin
<build> <defaultGoal>compile</defaultGoal> <plugins> <!-- 生成清单文件相关 --> ...
随机推荐
- centos查看端口被哪个应用端口占用命令
在linux一般使用netstat 来查看系统端口使用情况步. netstat命令是一个监控TCP/IP网络的非常有用的工具,它可以显示路由表.实际的网络连接以及每一个网络接口设备的 net ...
- 【GMT43智能液晶模块】基于HAL库的SDRAM和LCD驱动例程(MDK工程&CubeMX工程)
说明: 1.该工程基于HAL库实现动态存储器SDRAM驱动以及液晶控制器LCD驱动. 2.工程通过STM32CubeMX(Version 4.22.0)配置生成,可直接打开进行配置. 3.KEIL M ...
- [Z] SQL SERVER 的前世今生--各版本功能对比
https://www.cnblogs.com/OwenZeng/p/6813143.html
- shell md5sum
md5sum out.a echo "fd_limit=$(ulimit -n), fd_used=$(ll /proc/4741/fd | wc -l)" 需找句柄,及fd ...
- List接口:(介绍其下的两个实现类:ArrayList和LinkedList)
以下介绍接口: List接口:(介绍其下的两个实现类:ArrayList和LinkedList) ArrayList和数组非常类似,其底层①也用数组组织数据,ArrayList是动态可变数组. ① ...
- unity3D内嵌android项目
1.从u3d中导出android工程 工程名为 HS5 2.as(AndroidStudio简写)中新建android工程 MyAndroid 3.HS5 以module方式导入到MyAndroid ...
- 直播框架ijkplayer
直播框架ijkplayer [如何快速的开发一个完整的iOS直播app](播放篇) ijkplayer ios项目集成(图文详细版) 一步步搭建视频直播系统,基于LFLiveKit+ijkplayer ...
- puppet(1)-简介
puppet: 开源的.新一代的集中化的配置管理工具: 目标状态 配置语言 Luke Kanies,puppet labs bootstrap --> configuration --> ...
- 10.Oracle Golden Date(ogg)的搭建和管理
一. GoldenGate 概述 GoldenGate现在是业内成熟的数据容灾与复制产品:GoldenGate是一种基于日志的结构化数据复制方式,它通过解析源数据库在线日志或归档日志获得数据的增删改变 ...
- 使用react-navigation提示undefind is not a function
在学习react-natrive的时候,看到导航跳转一章,遂试了一下demo: 但是呢,在安卓模拟器上却报错了: 找了许多方法,包括降低版本都不行,后来修改了一下导出就可以了: