Skip to content

parsing of reproducible builds 'project.build.outputTimestamp' cannot handle default dateFormat #674

Closed
@Interessierter

Description

@Interessierter

Describe the bug (required)

in https://maven.apache.org/guides/mini/guide-reproducible-builds.html it is mentioned that you could do <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp> and this is IMHO indeed a neat idea.

If you do so, however, you'll get

[ERROR] Failed to execute goal io.github.git-commit-id:git-commit-id-maven-plugin:6.0.0:revision (get-the-git-infos) on project mautstation: Invalid 'project.build.outputTimestamp' value '2023-11-30T09:17:06+0100': Unparseable date: "2023-11-30T09:17:06+0100" -> [Help 1]

This is because the defaullt dateFormat is yyyy-MM-dd'T'HH:mm:ssZ but parseOutputTimestamp only tries to parse the format yyyy-MM-dd'T'HH:mm:ssXXX

It can be work-arounded by specifying the configuration <dateFormat>yyyy-MM-dd'T'HH:mm:ssXXX</dateFormat> but this shouldnt be neccessary.

Tell us about your plugin configuration (required)

		<plugin>
			<groupId>io.github.git-commit-id</groupId>
			<artifactId>git-commit-id-maven-plugin</artifactId>
			<version>6.0.0</version>
			<executions>
				<execution>
					<id>get-the-git-infos</id>
					<goals>
						<goal>revision</goal>
					</goals>
				</execution>
			</executions>
			<configuration>
				<generateGitPropertiesFile>true</generateGitPropertiesFile>
			</configuration>
		</plugin>

Tell us about the Plugin version used (required)

6.0.0

Tell us about the Maven version used (required)

mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Users\chris\AppData\Local\Programs\IntelliJ IDEA Ultimate\plugins\maven\lib\maven3
Java version: 17.0.2, vendor: Oracle Corporation, runtime: C:\java\openjdk-17.0.2
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Steps to Reproduce (required)

just configure the property <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp> in the POM

Are there any stacktraces or any error messages? (required)

Caused by: pl.project13.core.GitCommitIdExecutionException: Invalid 'project.build.outputTimestamp' value '2023-11-30T09:17:06+0100'
    at pl.project13.maven.git.GitCommitIdMojo.parseOutputTimestamp (GitCommitIdMojo.java:1511)
    at pl.project13.maven.git.GitCommitIdMojo$2.getReproducibleBuildOutputTimestamp (GitCommitIdMojo.java:1336)
    at pl.project13.core.GitCommitIdPlugin.loadBuildData (GitCommitIdPlugin.java:335)
    at pl.project13.core.GitCommitIdPlugin.runPlugin (GitCommitIdPlugin.java:295)
    at pl.project13.maven.git.GitCommitIdMojo.execute (GitCommitIdMojo.java:1453)

Is there a (public) project where this issue can be reproduced? (optional)

No response

Your Environment (optional)

No response

Context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions