spring-projects/spring-boot · error · MojoExecutionException

Invalid value for parameter 'outputTimestamp'

Error message

Invalid value for parameter 'outputTimestamp'

What it means

Thrown by RepackageMojo.parseOutputTimestamp as a MojoExecutionException wrapping an IllegalArgumentException from MavenBuildOutputTimestamp.toFileTime(). It is the user-facing wrapper for errors 35 (out-of-range) and 36 (unparseable). The <outputTimestamp> parameter (defaulting to ${project.build.outputTimestamp}) drives reproducible archive entry timestamps; any value the parser cannot accept surfaces here with a stable, parameter-focused message.

Source

Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java:210

					"Source file is not available, make sure 'package' runs as part of the same lifecycle");
		}
		Repackager repackager = getRepackager(source.getFile());
		Libraries libraries = getLibraries(this.requiresUnpack);
		try {
			repackager.repackage(target, libraries, parseOutputTimestamp());
		}
		catch (IOException ex) {
			throw new MojoExecutionException(ex.getMessage(), ex);
		}
		updateArtifact(source, target, repackager.getBackupFile());
	}

	private @Nullable FileTime parseOutputTimestamp() throws MojoExecutionException {
		try {
			return new MavenBuildOutputTimestamp(this.outputTimestamp).toFileTime();
		}
		catch (IllegalArgumentException ex) {
			throw new MojoExecutionException("Invalid value for parameter 'outputTimestamp'", ex);
		}
	}

	private Repackager getRepackager(File source) {
		return getConfiguredPackager(() -> new Repackager(source));
	}

	@Contract("!null -> !null")
	private @Nullable String removeLineBreaks(@Nullable String description) {
		return (description != null) ? WHITE_SPACE_PATTERN.matcher(description).replaceAll(" ") : null;
	}

	private void updateArtifact(Artifact source, File target, File original) {
		if (this.attach) {
			attachArtifact(source, target, original);
		}
		else if (source.getFile().equals(target) && original.exists()) {
			String artifactId = (this.classifier != null) ? "artifact with classifier " + this.classifier

View on GitHub (pinned to 5b2dbdbb8b)

Solutions

  1. Inspect the wrapped IllegalArgumentException — if it says 'Can't parse' (error 36), reformat to ISO-8601 or integer seconds; if it says 'not within the valid range' (error 35), choose a date in 1980-2099.
  2. Use a numeric epoch-second string for reproducible builds to avoid the ISO range/parsing constraints.
  3. Check both <outputTimestamp> on the repackage configuration and <project.build.outputTimestamp> in the POM/parent.
  4. Set outputTimestamp to 'off' or empty to disable reproducible timestamps if not needed.

Example fix

// before
<project.build.outputTimestamp>2024-01-01</project.build.outputTimestamp>
// after — valid ISO-8601 with offset, or integer epoch
<project.build.outputTimestamp>2024-01-01T00:00:00Z</project.build.outputTimestamp>
Defensive patterns

Strategy: validation

Validate before calling

// Validate outputTimestamp before invoking repackage
void validateOutputTimestamp(String ts) {
    if (ts == null || ts.isBlank() || "off".equalsIgnoreCase(ts)) return;
    if (ts.chars().allMatch(Character::isDigit)) return;
    try {
        var i = java.time.OffsetDateTime.parse(ts)
            .withOffsetSameInstant(java.time.ZoneOffset.UTC).toInstant();
        var min = java.time.Instant.parse("1980-01-01T00:00:02Z");
        var max = java.time.Instant.parse("2099-12-31T23:59:59Z");
        if (i.isBefore(min) || i.isAfter(max))
            throw new IllegalArgumentException("out of range: " + i);
    } catch (java.time.format.DateTimeParseException e) {
        throw new IllegalArgumentException("unparseable outputTimestamp: " + ts);
    }
}

Prevention

When it happens

Trigger: Setting <outputTimestamp> (or project.build.outputTimestamp) to a non-ISO, non-numeric string; a date before 1980 or after 2099 in ISO form; inheriting a parent POM whose outputTimestamp is in a legacy format; a CI variable injecting a malformed timestamp into project.build.outputTimestamp.

Common situations: Parent POM sets project.build.outputTimestamp to a Maven-formatted date; CI sets SOURCE_DATE_EPOCH as an ISO string with typo; team migrates to reproducible builds and picks an invalid epoch; a property placeholder resolves to an empty-but-not-null invalid token.

Related errors


AI-assisted analysis of spring-projects/spring-boot@5b2dbdbb8b (2026-08-04). Data as JSON: /data/errors/eccdbcc533a24527.json. Report an issue: GitHub.