当我运行测试时,我得到错误“命令行太长”。 如果我在运行/调试配置中将“缩短命令行”方法设置为特定方法或类的“JAR清单”,它就可以工作,但我如何为整个项目设置它,或者有IDE全局设置吗?


当前回答

智能 2018.2.5

Run => Edit Configurations =>选择左边的Node => expand Environment => Shorten Command line options =>选择Classpath file or JAR manifest

其他回答

感谢Rajesh Goel在Android Studio的贡献:

执行>编辑配置…

选择一个测试(最好选择一个父测试类),并将Shorten命令行:选项设置为类路径文件。然后OK(或Apply, OK)。

智能 2018.2.5

Run => Edit Configurations =>选择左边的Node => expand Environment => Shorten Command line options =>选择Classpath file or JAR manifest

添加<property name="dynamic. "<component name="PropertiesComponent">标签下的。idea/workspace.xml文件。这对我很管用。

在我的例子中,错误是:

Error running 'MasterFileGenerator':
Command line is too long. Shorten command line for StagingFileGenerator or also for Application default configuration.

解决方案是切换到“运行/调试配置”,并从用户本地默认:none - java [options] className [args]切换到JAR manifest - java -cp classpath.jar className [args]。

遵循这些步骤并选择“classpath”。从“缩短”命令行类别中给出的下拉列表中选择“文件”。