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> <!-- 生成清单文件相关 --> ...
随机推荐
- 修改Egret引擎代码的方法
某些情况下,我们需要修改Egret引擎的源码,我们可以在源码目录(一般如下:xxx\Egret\engine\x.x.x\src\egret)下直接修改ts代码. 在对应的项目下打开CMD命令行,输入 ...
- .NET HttpGet 获取服务器文件下的图片信息 同步和异步方式处理
/// <summary> /// 项目文件夹下路径 返回流类型数据,如:图片类型 /// </summary> /// <returns></returns ...
- C语言 · 数的划分
算法训练 数的划分 时间限制:1.0s 内存限制:256.0MB 锦囊1 使用动态规划. 锦囊2 用F[i,j,k]表示将i划分成j份,最后一份为k的方案数,则F[i,j,k]= ...
- PCL点云分割(3)
(1)Euclidean分割 欧几里德分割法是最简单的.检查两点之间的距离.如果小于阈值,则两者被认为属于同一簇.它的工作原理就像一个洪水填充算法:在点云中的一个点被“标记”则表示为选择在一个的集群中 ...
- Cannot create a session after the response has been committed
有时候在操作Session时,系统会抛出如下异常 java.lang.IllegalStateException: Cannot create a session after the response ...
- 3 ansible-playbook 条件语句-外部变量使用
外部变量指的是从playbook文件之外获取的数值 lookups file file是我们经常使用的一种lookups的方式,它的原理就是使用python的codecs.open打开文件然后把结果返 ...
- Rk3288 双屏异显单触摸
系统版本:RK3288 android 5.1 设备同时有两个lcd,主屏是mipi接口,带有触摸屏,触摸屏是usb接口,副屏是hdmi接口,没有触摸屏,正常情况下,两个lcd显示相同内容,触摸屏一切 ...
- 【中间件安全】WebSphere安全加固规范
1. 适用情况 适用于使用WebSphere进行部署的Web网站. 2. 技能要求 熟悉WebSphere安装部署,熟悉WebSphere常见漏洞利用方式,并能针对站点使用WebSphere进行安全加 ...
- 关于BigDecimal.ROUND_HALF_UP与ROUND_HALF_DOWN
ROUND_HALF_UP: 遇到.5的情况时往上近似,例: 1.5 ->;2ROUND_HALF_DOWN : 遇到.5的情况时往下近似,例: 1.5 ->;1 BigDecimal a ...
- 面试准备——(三)Selenium(1)基础问题及自动化测试
转载:https://www.cnblogs.com/lesleysbw/p/6413880.html 面试准备——(三)Selenium(1)基础问题及自动化测试 滴滴面试: 1. 自己负责哪部 ...