Idea 中出现:运行 Test 时出错。命令行过长。 通过 JAR 清单或通过类路径文件缩短命令行,然后重新运行。
在项目的 .idea 目录下的 workspace.xml 中的
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="settings.editor.selected.configurable" value="project.propCompiler" />
</component>
添加一个新的属性:
<property name="dynamic.classpath" value="true" />
也有可能是以下样式:
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"settings.editor.selected.configurable": "preferences.pluginManager"
}
}]]></component>
添加以下内容即可:
"dynamic.classpath": "true",
最终展示效果为:
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"settings.editor.selected.configurable": "preferences.pluginManager",
"dynamic.classpath": "true"
}
}]]></component>
本文介绍了IntelliJ IDEA中遇到运行测试时由于命令行过长导致的错误,提供了解决方案。可以通过修改.idea目录下workspace.xml文件,添加'dynamic.classpath'属性来缩短命令行,从而避免该问题。此方法适用于需要优化项目类路径配置的开发者。

被折叠的 条评论
为什么被折叠?



