Skip to content

JSON format output broken in 4.0.1 & 4.0.2 #517

@tfmorris

Description

@tfmorris

In 4.0.1 and 4.0.2, using <format>json</format> produces an almost empty JSON file which just contains

{
  "empty": false
}

Using the text properties format works correctly. The exact same configuration works in 4.0.0, but fails in 4.0.1 & 4.0.2. There are no error messages generated.

Steps to Reproduce

Here's the config file:

        <configuration>
            <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
            <verbose>false</verbose>
            <generateGitPropertiesFile>true</generateGitPropertiesFile>
            <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
            <failOnNoGitDirectory>false</failOnNoGitDirectory>
            <failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
            <format>json</format>
            <gitDescribe>
                <skip>false</skip>
                <always>false</always>
                <dirty>-dirty</dirty>
            </gitDescribe>
            <includeOnlyProperties>
              <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
              <includeOnlyProperty>^git.branch</includeOnlyProperty>
              <includeOnlyProperty>^git.commit.id.(abbrev|full|describe)$</includeOnlyProperty>
            </includeOnlyProperties>
        </configuration>

and the failed build following merging Dependabot's PR for the version upgrade: https://github.com/OpenRefine/OpenRefine/runs/959041175

These steps will reproduce the problem on the dependabot branch which updates the plugin to 4.0.2. The master branch with 4.0.0 produces the correct result.

git clone https://github.com/OpenRefine/OpenRefine.git
cd OpenRefine/main
git checkout dependabot/maven/pl.project13.maven-git-commit-id-plugin-4.0.2
mvn clean compile
cat webapp/WEB-INF/classes/git.properties

Expected behavior

Correct JSON output generated

Additional context

For reproducibility please provide the following:

My local versions are below, but it also fails using Github Actions on Ubuntu 18.0.4 LTS with versions listed here.

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/local/share/java/maven3
Java version: 1.8.0_171, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.6", arch: "x86_64", family: "mac"

Feel free to add any other context or screenshots about the bug.

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