Spring boot. Reading MANIFEST.MF using jcabi manifests

585 Views Asked by At

I'm trying to add AppName and Version to actuator's /info endpoint using jcabi-manifests https://github.com/jcabi/jcabi-manifests library. Code snippet is below:

@Component
public class VersionInfoContributor implements InfoContributor {

@Override
public void contribute(Info.Builder builder) {
    String artifactName = Manifests.read("Artifact-Name");

    builder.withDetail("Artifact-Name", artifactName);
}

Artifact-Name is set in build.gradle file next way:

jar {
   manifest {
        attributes("Artifact-Name": "TestActuator")
    }
}

The attribute IS present in META-INF/MANIFEST.MF file inside result .jar file but when trying to access /info endpoint getting error: Attribute 'Artifact-Name' not found in MANIFEST.MF file(s) among 46 other attribute(s)

I know there is BuildProperties bean in Spring-boot actuator but won't like idea to expose all these fields - AppName and Version more than enough.

0

There are 0 best solutions below