version-endpoint
Creates a version endpoint with git properties like SHA etc.
Requirements
pl.project13.maven:git-commit-id-plugin
plugin which generates${project.build.testOutputDirectory}/git.properties
org.springframework.boot:spring-boot-maven-plugin
plugin which generates${project.build.outputDirectory}/META-INF/build-info.properties
How to use it
<dependency>
<groupId>berlin.yuna</groupId>
<artifactId>version-endpoint</artifactId>
<version>0.2.2</version>
</dependency>
Configuration
management:
endpoint:
version:
path: /internal/version
git:
include: "*"
exclude: tags, branch
Example
{
"projectName": "version-endpoint",
"projectGroup": "berlin.yuna",
"projectArtifact": "version-endpoint",
"projectVersion": "0.2.2",
"git": {
"tags": "",
"build.version": "0.2.2",
"closest.tag.commit.count": "20",
"commit.user.name": "Yuna Morgenstern",
"commit.id.abbrev": "a6729de",
"branch": "testbranch",
"build.host": "Cr15t4lF1r3",
"commit.id.describe-short": "0.1.0-1-dirty",
"total.commit.count": "8",
"commit.id.describe": "0.1.0-1-ga6729de-dirty",
"build.user.email": "[email protected]",
"commit.id": "a6729de1f723aa3ddc84635a7cf9769dea489e17",
"commit.message.short": "my cool commit message",
"commit.user.email": "[email protected]",
"closest.tag.name": "0.2.2",
"local.branch.ahead": "0",
"build.time": "1988-08-20T20:12:58+0100",
"commit.time": "1988-08-20T18:22:17+0100",
"local.branch.behind": "0",
"build.user.name": "",
"dirty": "true",
"commit.message.full": "my cool commit message",
"remote.origin.url": "https://github.com/YunaBraska/version-endpoint.git"
}
}
Troubleshooting
- BuildProperties are not initialized: just the following command
mvn clean compile
- Add spring-boot-maven-plugin if the solution above did't help
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<phase>compile</phase>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
TODO
[ ] path to custom properties file