在Maven项目中运行测试用例时(在Windows上):
运行TestApp.readParameter时出错:命令行太长。为了缩短长度,可以使用classpath文件。您想要为项目的所有运行配置启用classpath文件模式吗?启用
set .iws
<property name="dynamic.classpath" value="true" />
如何解决这个问题?
在Maven项目中运行测试用例时(在Windows上):
运行TestApp.readParameter时出错:命令行太长。为了缩短长度,可以使用classpath文件。您想要为项目的所有运行配置启用classpath文件模式吗?启用
set .iws
<property name="dynamic.classpath" value="true" />
如何解决这个问题?
在Intellij中,进入“编辑配置”(运行 -> 编辑配置),在弹出的配置选项卡中,在“缩短命令行”一行中选择选项“classpath文件”/“@argFiles(Java 9+)”,下拉菜单中的最后一个选项。对我有用的是这个修复。
从您的项目根文件夹打开.idea/workspace.xml文件,转到该部分
<component name="PropertiesComponent">
并添加以下内容:
<property name="dynamic.classpath" value="true" />
我使用的是Intelli J。我按照以下步骤操作,现在可以运行我的测试。
这解决了我的问题。
我曾经长时间苦苦挣扎于这个错误,但其他答案都没有帮到我。
解决问题的方法是在Gradle的pitest
配置中添加以下行:
useClasspathFile = true
现在build.gradle
文件中有这样一条记录:
pitest {
threads = 4
//adds dependency to org.pitest:pitest-junit5-plugin and sets "testPlugin" to "junit5"
junit5PluginVersion = '0.12'
useClasspathFile = true <------------------------------
targetClasses = ["com.example.service.*"]
if (project.name in ['no-need-to-mutate-module']) {
failWhenNoMutations = false
}
}