使用 Eclipse Code Formatter 在其自己的行上配置枚举常量

Configure enum constants on its own line using Eclipse Code Formatter

我正在使用 Spotless with Gradle. I've configured 它来使用 Eclipse 的 JDT 代码格式化程序:

spotless {
  groovyGradle {
    greclipse("4.21.0").configFile("${rootDir}/config/spotless/eclipe_groovy_formatter.xml")
  }
  java {
    eclipse("4.21.0").configFile("${rootDir}/config/spotless/eclipe_jdt_formatter.xml")
    endWithNewline()
    importOrder("", "javax", "java")
    indentWithSpaces(2)
    lineEndings(LineEnding.UNIX)
    removeUnusedImports()
    trimTrailingWhitespace()
  }
}

eclipe_jdt_formatter.xml的内容就是:

<?xml version="1.0" encoding="UTF-8" ?>
<profiles version="12">
  <profile kind="CodeFormatterProfile" name="Fulgore Team" version="12">
    <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80" />
    <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="false" />
    <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="100" />
    <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert" />
    <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert" />
  </profile>
</profiles>

问题是我想在 (Eclipse) XML 文件中配置正确的设置,以便每个 enum 值都在其自己的行上。

例如,这是它当前格式化源代码的方式:

public enum Type {
  VALUE, OTHER, ANOTHER,
}

...但我想:

public enum Type {
  VALUE,
  OTHER,
  ANOTHER,
}

如果有人知道我可以在 XML 文件中使用的设置组合来完成此操作,我将不胜感激。我尝试了 .formatter and/or .indent 中的几个组合,但没有成功。

尝试<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="49"/>