projectlombok/lombok · error · BuildException

Either 'from' attribute, or nested

Error message

Either 'from' attribute, or nested <fileset> tags are required.

What it means

DelombokTaskImpl.execute validates that an input was configured. You must provide either the `from` attribute (a directory) or at least one nested `<fileset>` (exposed as `path`); with neither, delombok has nothing to process and throws BuildException.

Solutions

  1. Add `from="src/main/java"` to the delombok task, or
  2. Add a nested `<fileset dir="src/main/java"><include name="**/*.java"/></fileset>`
  3. Verify the attribute is spelled `from` and is actually set in your build

Example fix

<!-- before -->
<delombok to="build/delomboked"/>
<!-- after -->
<delombok to="build/delomboked" from="src/main/java"/>
Defensive patterns

Strategy: validation

Validate before calling

if (task.getFrom() == null && !hasFilesets(task)) throw new IllegalStateException("delombok needs from or a fileset");

Try / catch

catch (BuildException e) { if (e.getMessage().startsWith("Either 'from'")) { /* add input config */ } throw e; }

Prevention

When it happens

Trigger: An Ant `<delombok to="...">` task with no `from` attribute and no nested `<fileset>`/`<filelist>` elements; calling `execute(Location)` programmatically after setting only `to`.

Common situations: Newly written Ant targets that only set `to`; refactoring that removed a `<fileset>` but left the `from`-less task; typo'd `from` attribute name so it is never set.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

import lombok.delombok.Delombok.InvalidFormatOptionException;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.resources.FileResource;

public class DelombokTaskImpl {
	private File fromDir, toDir;
	private Path classpath;
	private Path sourcepath;
	private Path modulepath;
	private boolean verbose;
	private String encoding;
	private Path path;
	private List<String> formatOptions = new ArrayList<String>();
	
	public void execute(Location location) throws BuildException {
		if (fromDir == null && path == null) throw new BuildException("Either 'from' attribute, or nested <fileset> tags are required.");
		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) {

View on GitHub (pinned to 6d6a3e9fec)