当我运行测试时,我收到错误“命令行太长”。 如果我将运行/调试配置中的“缩短命令行”方法设置为特定方法或类的“JAR 清单”,它会起作用,但如何为整个项目设置它,或者是否有 IDE 全局设置?
在 .idea 文件夹中,更改workspace.xml 文件
添加
<property name="dynamic.classpath" value="true" />
到
<component name="PropertiesComponent">
.
.
.
</component>
示例
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
<property name="dynamic.classpath" value="true" />
</component>
如果您没有看到,请自行添加
<component name="PropertiesComponent">
<property name="dynamic.classpath" value="true" />
</component>
社区编辑:这个解决方案似乎不适用于较新版本的IDE,现在
PropertiesComponent
的格式不同了。如果这是你的情况,那么这个答案应该有效
将
<property name="dynamic.classpath" value="true" />
添加到 .idea/workspace.xml
标签下的 <component name="PropertiesComponent">
文件中。这对我有用。
就我而言,错误是:
Error running 'MasterFileGenerator':
Command line is too long. Shorten command line for StagingFileGenerator or also for Application default configuration.
解决方案是切换到“运行/调试配置”并从
user-local default: none - java [options] className [args]
切换到 JAR manifest - java -cp classpath.jar className [args]
。
让它坚持下去:
<property name="dynamic.classpath" value="true" />
b) 如果存在 keyToString json,请在地图中添加新行:
"dynamic.classpath": "true"
(记住上面一行的逗号)
理念2022+ 运行 > 编辑配置... > 编辑配置模板..(模式窗口中的左下角链接)> 选择模板 > 修改选项 > 缩短命令行