projectlombok/lombok · error · BuildException

Run java -jar lombok.jar --format-help for detailed format…

Error message

${message} Run java -jar lombok.jar --format-help for detailed format help.

What it means

The Ant task converts its `<format>` elements to a format-preferences map via `Delombok.formatOptionsToMap`. If an option name/value is not recognized, that method throws InvalidFormatOptionException; the task wraps it in a BuildException appending a pointer to `java -jar lombok.jar --format-help`.

Solutions

  1. Run `java -jar lombok.jar --format-help` and use only listed option names/values
  2. Fix the option string to the `name:value` form with a valid value
  3. Remove unknown `<format>` elements; check the lombok version your Ant task runs against (rename/remove stale options)

Example fix

<!-- before -->
<delombok from="src" to="out">
  <format name="indentation" value="4"/>
</delombok>
<!-- after -->
<delombok from="src" to="out">
  <format name="indent" value="4"/>
</delombok>
Defensive patterns

Strategy: try-catch

Validate before calling

Map<String,String> opts = Delombok.formatOptionsToMap(formatOptions); // run once at build-authoring time to validate

Try / catch

try {
    delombok.setFormatPreferences(Delombok.formatOptionsToMap(formatOptions));
} catch (InvalidFormatOptionException e) {
    throw new BuildException(e.getMessage() + " Run java -jar lombok.jar --format-help for detailed format help.");
}

Prevention

When it happens

Trigger: A nested `<format name="someUnknownKey" value="..."/>` or a `key:value` string whose value is illegal, passed to `setFormatPreferences` inside `execute`. Also occurs when the format option string is malformed (missing ':').

Common situations: Typos in option names (`indent` vs `indentation`); reusing options from other tools (e.g. google-java-format flags); upgrading lombok and using an option that was renamed or removed.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07). Data as JSON: /api/errors/5e69815cf43df970. Report an issue: GitHub.

Appendix: source

Thrown at src/delombok/lombok/delombok/ant/DelombokTaskImpl.java:69

		if (fromDir != null && path != null) throw new BuildException("You can't specify both 'from' attribute and nested filesets. You need one or the other.");
		if (toDir == null) throw new BuildException("The to attribute is required.");
		
		Delombok delombok = new Delombok();
		if (verbose) delombok.setVerbose(true);
		try {
			if (encoding != null) delombok.setCharset(encoding);
		} catch (UnsupportedCharsetException e) {
			throw new BuildException("Unknown charset: " + encoding, location);
		}
		
		if (classpath != null) delombok.setClasspath(classpath.toString());
		if (sourcepath != null) delombok.setSourcepath(sourcepath.toString());
		if (modulepath != null) delombok.setModulepath(modulepath.toString());
		
		try {
			delombok.setFormatPreferences(Delombok.formatOptionsToMap(formatOptions));
		} catch (InvalidFormatOptionException e) {
			throw new BuildException(e.getMessage() + " Run java -jar lombok.jar --format-help for detailed format help.");
		}
		
		delombok.setOutput(toDir);
		try {
			if (fromDir != null) delombok.addDirectory(fromDir);
			else {
				Iterator<?> it = path.iterator();
				while (it.hasNext()) {
					FileResource fileResource = (FileResource) it.next();
					File baseDir = fileResource.getBaseDir();
					if (baseDir == null) {
						File file = fileResource.getFile();
						delombok.addFile(file.getParentFile(), file.getName());
					} else {
						delombok.addFile(baseDir, fileResource.getName());
					}
				}
			}

View on GitHub (pinned to 6d6a3e9fec)