projectlombok/lombok · error · BuildException
You can't specify both 'from' attribute and nested…
Error message
You can't specify both 'from' attribute and nested filesets. You need one or the other.
What it means
DelombokTaskImpl.execute rejects mutually exclusive input specifications: `from` (single directory) and nested filesets cannot both be present, because the task would not know whether to scan one directory or the fileset list. Both set at once throws BuildException.
Solutions
- Remove the `from` attribute and keep the `<fileset>` elements, or
- Remove the `<fileset>` elements and keep `from`
- To narrow a `from` directory scan, switch entirely to filesets with include/exclude patterns
Example fix
<!-- before --> <delombok from="src/main/java" to="out"> <fileset dir="src/main/java"><include name="**/*.java"/></fileset> </delombok> <!-- after --> <delombok to="out"> <fileset dir="src/main/java"><include name="**/*.java"/></fileset> </delombok>
Defensive patterns
Strategy: validation
Validate before calling
if (fromDir != null && (path != null || hasFilesets)) throw new IllegalStateException("use from OR filesets, not both"); Try / catch
catch (BuildException e) { if (e.getMessage().contains("both 'from'")) { /* remove one input spec */ } throw e; } Prevention
- Pick one input style per task and document it in the build
- Review diffs that merge ant targets
- Use include/exclude patterns in filesets instead of adding from
When it happens
Trigger: An Ant `<delombok from="src" to="out">` that also contains `<fileset>` children; calling `setFrom(...)` and `createFileset()`/`setPath(...)` on the task instance programmatically.
Common situations: Merging two working delombok task definitions into one; adding a fileset to narrow the scan while forgetting to remove `from`.
Related errors
- Either 'from' attribute, or nested
- 'value' property required for
- The to attribute is required.
- Unknown charset
- Run java -jar lombok.jar --format-help for detailed format…
AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07).
Data as JSON: /api/errors/2a7753c2dfc1fad6.
Report an issue: GitHub.
Appendix: source
Thrown at src/delombok/lombok/delombok/ant/DelombokTaskImpl.java:51
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) {
throw new BuildException(e.getMessage() + " Run java -jar lombok.jar --format-help for detailed format help.");View on GitHub (pinned to 6d6a3e9fec)