surfire单元测试添加jvm参数
有人配置jvm 参数可以是上面形式:
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.19.1</version><configuration><systemPropertyVariables><jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile></systemPropertyVariables><argLine>${argLine} -XX:NewSize=128m -XX:MaxNewSize=512m -XX:PermSize=128m -XX:MaxPermSize=768m</argLine></configuration></plugin>
如果添加
-noverify -XX:-UseSplitVerifier
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.19.1</version><configuration><systemPropertyVariables><jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile></systemPropertyVariables><argLine>${argline} -noverify -XX:-UseSplitVerifier -XX:NewSize=128m -XX:MaxNewSize=512m -XX:PermSize=128m -XX:MaxPermSize=768m</argLine></configuration></plugin>
会报错!!!!!!!!!!!!!!!
去掉${argLine} 改成-noverify -XX:-UseSplitVerifier -XX:NewSize=128m -XX:MaxNewSize=512m -XX:PermSize=128m -XX:MaxPermSize=768m 才正常!!!!
为什么呢??????????????????????
官网上配置参数: 连接http://maven.apache.org/components/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html
<plugins>
[...]<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.20.1</version><configuration><forkCount>3</forkCount><reuseForks>true</reuseForks><argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine><systemPropertyVariables><databaseSchema>MY_TEST_SCHEMA_${surefire.forkNumber}</databaseSchema></systemPropertyVariables><workingDirectory>FORK_DIRECTORY_${surefire.forkNumber}</workingDirectory></configuration></plugin>
[...]
</plugins>
讲解:
<argLine>${argLine} -XX:NewSize=128m -XX:MaxNewSize=512m -XX:PermSize=128m -XX:MaxPermSize=768m</argLine></configuration>其实是${argLine}变量和后面参数的拼接,argLine变量上面又没有声明,所以会出错,有的构建直接会取jacoco中默认的argLine变量,因为jacoco插件中会默认声明,且初始是空字符串,所有构建又不会报错。
所以正确方式是没有${argLine}的。
jacoco 源码:
@Overridepublic void executeMojo() {final String name = getEffectivePropertyName();final Properties projectProperties = getProject().getProperties();final String oldValue = projectProperties.getProperty(name);final String newValue = createAgentOptions().prependVMArguments(oldValue, getAgentJarFile());getLog().info(name + " set to " + newValue);projectProperties.setProperty(name, newValue);}String getEffectivePropertyName() {if (isPropertyNameSpecified()) {return propertyName;}if (isEclipseTestPluginPackaging()) {return TYCHO_ARG_LINE;}return SUREFIRE_ARG_LINE;}static final String SUREFIRE_ARG_LINE = "argLine";
surfire单元测试添加jvm参数相关推荐
- 添加 JVM 参数选项
一 IDE Eclipse 和 IDEA 中配置简单,在 Run Configurations 中 VM Options 中配置即可,大同小异. 二 运行 jar 包 java -Xms100m -X ...
- java:jvm参数设置
java:jvm参数设置 1 前言 jvm参数设置后,可通过System.getProperties()或者System.getProperty("jdbc.drivers")来获 ...
- tomcat配置jvm参数
由于项目中使用了阿里开源项目Fastjson 1.2.68 版本之前出现反序列化漏洞,需要更新至最新版本并添加配置, 详情可以查看:http://blog.nsfocus.net/fastjson-0 ...
- CMS:听我的,生产环境上要这样配置JVM参数
哪怕JDK16 GA已经发布很久了,但是,可以肯定的是,绝大多数的生产环境依然运行的是JDK8.此处必须来一句:JDK8 yyds.既然运行的是JDK8,那么生产环境的垃圾回收器基本上就是下面3种啦: ...
- JVM 参数及各部分含义(转)
转自:https://www.jianshu.com/p/1c6b5c2e95f9 JVM参数分类 JVM参数分为标准参数和非标准参数: 标准参数: "-"开头的参数,如-clie ...
- 优化JVM参数提升Eclipse运行速度
http://www.iteye.com/topic/1117534 首先建立评估体系,将workspace里所有的项目close掉,关闭eclipse.优化的用例就是启动eclipse,open一个 ...
- 如何在maven环境中设置JVM参数
2019独角兽企业重金招聘Python工程师标准>>> 有时候我们需要设定maven环境下的JVM参数,以便通过maven执行的命令或启动的系统能得到它们需要的参数设定.比如:当我们 ...
- JVM 参数使用总结
1. 参数分类 1.标准参数 功能和输出的参数都是很稳定的 在未来的JVM版本中不会改变 可以使用java -help检索出所有的标准参数 2.X参数 非标准化参数 在未来的版本可能会改变 所有的 ...
- idea java opts_idea为java程序添加启动参数(program arguments,vm arguments,Environment variable),并在程序中获取使用...
# 一.问题描述 # ## 1. 开发环境 ## 1. idea2019 2. jdk1.8 3. win10 在实际的项目开发中我们经常需要为java程序添加一些启动参数(又叫java启动命令),比 ...
最新文章
- Ubuntu上安装nginx步骤及问题记录
- B端会员模块的思考与设计
- NFS mount failed, reason given by server: Permission denied ---nfs挂载失败
- 给PUBG Mobile打上几十个数据标签解析霸榜原因
- C++中,float double区别
- PicoDet网络结构在YOLOv5-Lite上的复现
- 高精度ua级恒流源_UWB高精度室内定位系统案例--漫途科技
- 日均千万级消息规模,深捷旅使用函数计算释放运维压力
- 50台电脑文件服务器,50台电脑云桌面用什么服务器
- 软件项目管理 3.1.生存期模型选择
- 启动tomcat报错:Could not load the Tomcat server configuration at \Servers\Tomcat v7.0 Server at localhos
- Nginx配置https(ssl证书)并反向代理Springboot Jar项目
- 如何禁止win7自动锁屏
- 测试 软通动力软件测试机试_软通动力软件测试笔试题
- 等保测评 安全计算坏境之mysql数据库管理系统
- 【设计模式】工厂系列
- C/C++之cstring头文件
- matlab软件的功能介绍
- STM32F429第二十篇之高级定时器——PWM(OSSI,OSSR)
- 迅为4412开发板Linux驱动教程之GPIO的初始化