{"id":"eccdbcc533a24527","repo":"spring-projects/spring-boot","slug":"invalid-value-for-parameter-outputtimestamp","errorCode":null,"errorMessage":"Invalid value for parameter 'outputTimestamp'","messagePattern":"Invalid value for parameter 'outputTimestamp'","errorType":"validation","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java","lineNumber":210,"sourceCode":"\t\t\t\t\t\"Source file is not available, make sure 'package' runs as part of the same lifecycle\");\n\t\t}\n\t\tRepackager repackager = getRepackager(source.getFile());\n\t\tLibraries libraries = getLibraries(this.requiresUnpack);\n\t\ttry {\n\t\t\trepackager.repackage(target, libraries, parseOutputTimestamp());\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tthrow new MojoExecutionException(ex.getMessage(), ex);\n\t\t}\n\t\tupdateArtifact(source, target, repackager.getBackupFile());\n\t}\n\n\tprivate @Nullable FileTime parseOutputTimestamp() throws MojoExecutionException {\n\t\ttry {\n\t\t\treturn new MavenBuildOutputTimestamp(this.outputTimestamp).toFileTime();\n\t\t}\n\t\tcatch (IllegalArgumentException ex) {\n\t\t\tthrow new MojoExecutionException(\"Invalid value for parameter 'outputTimestamp'\", ex);\n\t\t}\n\t}\n\n\tprivate Repackager getRepackager(File source) {\n\t\treturn getConfiguredPackager(() -> new Repackager(source));\n\t}\n\n\t@Contract(\"!null -> !null\")\n\tprivate @Nullable String removeLineBreaks(@Nullable String description) {\n\t\treturn (description != null) ? WHITE_SPACE_PATTERN.matcher(description).replaceAll(\" \") : null;\n\t}\n\n\tprivate void updateArtifact(Artifact source, File target, File original) {\n\t\tif (this.attach) {\n\t\t\tattachArtifact(source, target, original);\n\t\t}\n\t\telse if (source.getFile().equals(target) && original.exists()) {\n\t\t\tString artifactId = (this.classifier != null) ? \"artifact with classifier \" + this.classifier","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java#L192-L228","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Use a numeric epoch-second string for reproducible builds to avoid the ISO range/parsing constraints.","Check both <outputTimestamp> on the repackage configuration and <project.build.outputTimestamp> in the POM/parent.","Set outputTimestamp to 'off' or empty to disable reproducible timestamps if not needed."],"exampleFix":"// before\n<project.build.outputTimestamp>2024-01-01</project.build.outputTimestamp>\n// after — valid ISO-8601 with offset, or integer epoch\n<project.build.outputTimestamp>2024-01-01T00:00:00Z</project.build.outputTimestamp>","handlingStrategy":"validation","validationCode":"// Validate outputTimestamp before invoking repackage\nvoid validateOutputTimestamp(String ts) {\n    if (ts == null || ts.isBlank() || \"off\".equalsIgnoreCase(ts)) return;\n    if (ts.chars().allMatch(Character::isDigit)) return;\n    try {\n        var i = java.time.OffsetDateTime.parse(ts)\n            .withOffsetSameInstant(java.time.ZoneOffset.UTC).toInstant();\n        var min = java.time.Instant.parse(\"1980-01-01T00:00:02Z\");\n        var max = java.time.Instant.parse(\"2099-12-31T23:59:59Z\");\n        if (i.isBefore(min) || i.isAfter(max))\n            throw new IllegalArgumentException(\"out of range: \" + i);\n    } catch (java.time.format.DateTimeParseException e) {\n        throw new IllegalArgumentException(\"unparseable outputTimestamp: \" + ts);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on integer epoch-second values for reproducible builds (no parse/range issues).","Audit parent POMs for legacy project.build.outputTimestamp formats.","Add a CI check that validates the timestamp format/range before the build."],"tags":["maven","spring-boot","repackage","outputtimestamp","configuration"],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}