IDEA 运行单元测试报错 @{argLine}
sentinel是今年阿里开源的高可用防护的流量管理框架。
git地址:https://github.com/alibaba/Sentinel
wiki:https://github.com/alibaba/Sentinel/wiki
FAQ:https://github.com/alibaba/Sentinel/wiki/FAQ
--------------------------------------------------------------------------------------------------------------------------------------------------------
工程里有很多单元测试,在IDEA里运行时报错:
����: �Ҳ��������������� @{argLine}
错误信息有乱码,VM参数加上-Dfile.encoding=UTF-8,再次运行:
错误: 找不到或无法加载主类 @{argLine}
解决方法:File->Settings->Build,Execution,Deployment->Build Tools->Maven->Running Tests 去掉argLine的勾选
--------------------------------------------------------------------------------------------------------------------------------------------------------
ctrl+shift+F全局搜索@{argLine},发现在sentinel-parent父工程的pom.xml里,使用了一个maven插件
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <!-- CircleCI build workaround --> <argLine>@{argLine} -Xms1024m -Xmx2048m</argLine> <useSystemClassLoader>false</useSystemClassLoader> </configuration> </plugin>
参考maven官方文档:http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#late-property-evaluation
allows late replacement of properties when the plugin is executed, so properties that have been modified by other plugins will be picked up correctly.
该占位符能让后面的插件在执行时正确的替换属性。
sentinel官方团队也在钉钉群给了说明:
这是 CI 生成测试覆盖率报告的时候自动装填用的,本地可以去掉。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· Ollama——大语言模型本地部署的极速利器
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现