apache/maven · error · BuildResumptionPersistenceException

Could not create resume.properties file.

Error message

Could not create resume.properties file.

What it means

Maven could not write target/resume.properties, the file that powers --resume/-r by recording the projects still to build after a --fail-at-end run. DefaultBuildResumptionDataRepository.persistResumptionData() creates the build directory and stores a Properties file; any IOException (directory creation, open, or write failure) is wrapped in BuildResumptionPersistenceException with this message.

Source

Thrown at impl/maven-core/src/main/java/org/apache/maven/execution/DefaultBuildResumptionDataRepository.java:62

    private static final String RESUME_PROPERTIES_FILENAME = "resume.properties";
    private static final String REMAINING_PROJECTS = "remainingProjects";
    private static final String PROPERTY_DELIMITER = ", ";
    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultBuildResumptionDataRepository.class);

    @Override
    public void persistResumptionData(MavenProject rootProject, BuildResumptionData buildResumptionData)
            throws BuildResumptionPersistenceException {
        Properties properties = convertToProperties(buildResumptionData);

        Path resumeProperties = Paths.get(rootProject.getBuild().getDirectory(), RESUME_PROPERTIES_FILENAME);
        try {
            Files.createDirectories(resumeProperties.getParent());
            try (Writer writer = Files.newBufferedWriter(resumeProperties)) {
                properties.store(writer, null);
            }
        } catch (IOException e) {
            String message = "Could not create " + RESUME_PROPERTIES_FILENAME + " file.";
            throw new BuildResumptionPersistenceException(message, e);
        }
    }

    private Properties convertToProperties(final BuildResumptionData buildResumptionData) {
        Properties properties = new Properties();

        String value = String.join(PROPERTY_DELIMITER, buildResumptionData.getRemainingProjects());
        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);
    }

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Verify the project's target/ directory is creatable and writable; fix ownership/permissions or free disk space
  2. Delete a stale/corrupt target/resume.properties and rerun
  3. Prevent concurrent builds from sharing one build directory
  4. If resumption is not needed, drop the -r/--resume and --fail-at-end combination that triggers persistence
Defensive patterns

Strategy: try-catch

Validate before calling

// Before the build, ensure the resumption file location is writable
Path target = project.getBasedir().toPath().resolve("target");
Files.createDirectories(target);
Path probe = target.resolve(".write-probe");
Files.writeString(probe, "x");
Files.deleteIfExists(probe);

Try / catch

try {
    resumptionDataRepository.persistResumptionData(rootProject, data);
} catch (BuildResumptionPersistenceException e) {
    // Resumption is an optimization: log, keep building, but tell the user -r will not work
    log.warn("--resume will be unavailable: {}", e.getCause().getMessage());
}

Prevention

When it happens

Trigger: A --fail-at-end build reaches resumption-data persistence while rootProject.getBuild().getDirectory() (usually target/) cannot be created or written: permission denied, read-only filesystem, disk full, resume.properties locked by another process (Windows), or the path occupied by a regular file.

Common situations: CI workspaces with restricted permissions; disk-full agents; two builds racing on the same checkout/target directory; antivirus or file indexers locking files on Windows.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/24ad97f362b99524. Report an issue: GitHub.