-
通过Toggle 'Skip Tests' Mode跳过测试解决数据库插入两条数据的问题
前段时间在做一个Maven项目的小功能时,需要将数据存储进数据库,但是却遇到了插入一条记录,执行成功后,数据库却存入两条数据的情况。并且每次执行都会输出如下的信息:
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< org.example:crud >--------------------------
[INFO] Building crud Maven Webapp 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ crud ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ crud ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ crud ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ crud ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to G:\IdeaProjects\crud\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ crud ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:3.2.2:war (default-war) @ crud ---
[INFO] Packaging webapp
[INFO] Assembling webapp [crud] in [G:\IdeaProjects\crud\target\crud]
[INFO] Processing war project
[INFO] Copying webapp resources [G:\IdeaProjects\crud\src\main\webapp]
[INFO] Webapp assembled in [307 msecs]
[INFO] Building war: G:\IdeaProjects\crud\target\crud.war
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ crud ---
[INFO] Installing G:\IdeaProjects\crud\target\crud.war to E:\Programming\Maven\maven-repository\org\example\crud\1.0-SNAPSHOT\crud-1.0-SNAPSHOT.war
[INFO] Installing G:\IdeaProjects\crud\pom.xml to E:\Programming\Maven\maven-repository\org\example\crud\1.0-SNAPSHOT\crud-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.750 s
[INFO] Finished at: 2021-04-10T04:28:03+08:00
[INFO] ------------------------------------------------------------------------
经过多次测试检查后,发现通过IntelliJ IDEA找到Maven Projects面板,顶部有一个Toggle 'Skip Tests' Mode 图标(命令行方式:mvn clean package -Dmaven.test.skip=true
),选中它后再执行package
或者install
打包就会跳过测试。
最后再去执行自己的业务代码,插入成功且只有一条记录!后续对该功能问题有更好的理解再回来补充吧。
出处:https://www.cnblogs.com/xiqingbo/p/issue-03.html
最新更新
求1000阶乘的结果末尾有多少个0
详解MyBatis延迟加载是如何实现的
IDEA 控制台中文乱码4种解决方案
SpringBoot中版本兼容性处理的实现示例
Spring的IOC解决程序耦合的实现
详解Spring多数据源如何切换
Java报错:UnsupportedOperationException in Col
使用Spring Batch实现批处理任务的详细教程
java中怎么将多个音频文件拼接合成一个
SpringBoot整合ES多个精确值查询 terms功能实
数据库审计与智能监控:从日志分析到异
SQL Server 中的数据类型隐式转换问题
SQL Server中T-SQL 数据类型转换详解
sqlserver 数据类型转换小实验
SQL Server数据类型转换方法
SQL Server 2017无法连接到服务器的问题解决
SQLServer地址搜索性能优化
Sql Server查询性能优化之不可小觑的书签查
SQL Server数据库的高性能优化经验总结
SQL SERVER性能优化综述(很好的总结,不要错
uniapp/H5 获取手机桌面壁纸 (静态壁纸)
[前端] DNS解析与优化
为什么在js中需要添加addEventListener()?
JS模块化系统
js通过Object.defineProperty() 定义和控制对象
这是目前我见过最好的跨域解决方案!
减少回流与重绘
减少回流与重绘
如何使用KrpanoToolJS在浏览器切图
performance.now() 与 Date.now() 对比