Skip to content

Let maven access the .git directory #200

@sovereignstack

Description

@sovereignstack

We use the maven commit-id plugin to push git version information inside every build so that build can be traced back to commit-id. This plugin takes git metadata from .git directory and creates a files that's inserted into the build. However, buildpacks apparently does not keep the .git directory visible/accessible to the build process and hence the maven plugin fails to work. Leading to the error:
Failed to execute goal pl.project13.maven:git-commit-id-plugin:4.9.10:revision (default) on project fooservice: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml

Note: We use kpack for build

Describe the Enhancement

It would be nice if the .git directory remains accessible by the build process. Many build scripts would expect that directory to be present for a similar requirement.

Possible Solution

Please let the .git directory be accessible to the build process. If that can't be made the default, provide a flag to do so.

Motivation

Baking source commit-id info into a build is a common practice. It helps in debugging/reporting issues. I read about the git build-pack. It puts commit id into an environment variable. But I can't use that as I need a git.proerties file that the above plugin generates. This file is later used by Spring (framework) at runtime to present build information at a specific http endpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions