apache/maven · warning
Could not delete {} file.
Error message
Could not delete {} file. What it means
DefaultBuildResumptionDataRepository.removeResumptionData deletes the resume state file (target/resume.properties in the root project's build directory) after a resumed build. If Files.deleteIfExists raises IOException - typically a file lock on Windows or a read-only target directory - Maven logs this warning and continues; the stale file is simply rewritten on the next failed build.
Source
Thrown at impl/maven-core/src/main/java/org/apache/maven/execution/DefaultBuildResumptionDataRepository.java:88
properties.setProperty(REMAINING_PROJECTS, value);
return properties;
}
@Override
public void applyResumptionData(MavenExecutionRequest request, MavenProject rootProject) {
Properties properties =
loadResumptionFile(Paths.get(rootProject.getBuild().getDirectory()));
applyResumptionProperties(request, properties);
}
@Override
public void removeResumptionData(MavenProject rootProject) {
Path resumeProperties = Paths.get(rootProject.getBuild().getDirectory(), RESUME_PROPERTIES_FILENAME);
try {
Files.deleteIfExists(resumeProperties);
} catch (IOException e) {
LOGGER.warn("Could not delete {} file. ", RESUME_PROPERTIES_FILENAME, e);
}
}
private Properties loadResumptionFile(Path rootBuildDirectory) {
Properties properties = new Properties();
Path path = rootBuildDirectory.resolve(RESUME_PROPERTIES_FILENAME);
if (!Files.exists(path)) {
LOGGER.warn("The {} file does not exist. The --resume / -r feature will not work.", path);
return properties;
}
try (Reader reader = Files.newBufferedReader(path)) {
properties.load(reader);
} catch (IOException e) {
LOGGER.warn("Unable to read {}. The --resume / -r feature will not work.", path);
}
return properties;View on GitHub (pinned to e4093d4e12)
Solutions
- Delete target/resume.properties manually once no other process holds it, then re-run
- Fix directory permissions so the build user owns the root module's target/
- Stop running concurrent Maven builds against the same checkout/workspace
- Ignore it: harmless in itself; the next failed build overwrites the file
Defensive patterns
Strategy: validation
Validate before calling
// before triggering a resumed build programmatically, ensure the file is deletable
Path target = Paths.get(rootProject.getBuild().getDirectory());
Path resume = target.resolve("resume.properties");
if (Files.exists(resume) && !Files.isWritable(target)) {
throw new IllegalStateException("target/ not writable; resume file cannot be removed later");
} Prevention
- Never run two Maven builds concurrently on the same checkout
- Exclude target/ from antivirus/on-access scanning on Windows
- Keep build user as owner of the workspace (avoid root-created target/ in containers)
When it happens
Trigger: A resumed build finishes and Maven tries to delete root-module target/resume.properties while another process (IDE file indexer, antivirus, a second concurrent Maven run on the same checkout) holds the file open, or the target directory does not grant delete permission to the build user.
Common situations: Windows workstations with antivirus/indexing scanning target/; two CI jobs sharing one workspace; container builds where target/ was created by root and the build runs as another user.
Related errors
- Error reading config file: ${atFile}
- Error reading config file: ${configFile}
- Error while deploying metadata: {}
- Could not create local repository at {}
- Could not create resume.properties file.
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/93eabe03408f8640.
Report an issue: GitHub.