首页 > 解决方案 > 如何为所有 IntelliJ IDEA 配置默认的“Shorten command line”方法(或其他运行/调试配置选项)?

问题描述

我知道如何为特定配置(例如特定的 JUnit 测试配置)和特定的配置模板(例如所有新的 JUnit 测试配置)设置“缩短命令行”。是否可以将 IntelliJ IDEA 配置为默认设置为特定设置(即在 中设置的内容~/.IntelliJIdea*),以便所有配置(例如 JUnit、Cucumber、Spring Boot 等)默认使用该默认方法?

标签: intellij-idea

解决方案


我还没有找到为所有配置类型设置它的方法,但是有一种方法可以将它设置为特定配置类型的 IDEA 默认值。

首先,在 中,如果它尚不存在,则~/.IntelliJIdea*/config/options/project.default.xml创建一个元素。<component name="ProjectManager"><defaultProject><component name="RunManager">…&lt;/component></defaultProject></component>

然后,对于要默认的每种配置类型:

  1. 在模板中为现有项目中的该配置类型设置项目默认值。
  2. 在该项目的.idea/workspace.xml文件中,复制该配置类型的<configuration>…&lt;/configuration>元素内的<component name="RunManager">…&lt;/component>元素。
  3. 将该块粘贴到~/.IntelliJIdea*/config/options/project.default.xml里面<component name="ProjectManager"><defaultProject><component name="RunManager">…&lt;/component></defaultProject></component>

重新启动 IntelliJ IDEA,以便所有实例都采用新的默认值并且不会覆盖,project.default.xml从而清除设置。

保存project.default.xml以防退出 IntelliJ IDEA 覆盖修改。


推荐阅读