0

Context: I downloaded an initialized project from https://micronaut.io/launch/ and I added both gradle-git-properties plugin and micronaut-management dependency in order to expose git.properties as explained in adding commit info guide

I checked my project buil/resources/main and I see this git.properties

git.branch=
git.build.host=SPANOT149
git.build.user.email=jimis.drpc@gmail.com
git.build.user.name=Jimis.drpc
git.build.version=0.1
git.closest.tag.commit.count=
git.closest.tag.name=
git.commit.id=
git.commit.id.abbrev=
git.commit.id.describe=
git.commit.message.full=
git.commit.message.short=
git.commit.time=
git.commit.user.email=
git.commit.user.name=
git.dirty=true
git.remote.origin.url=
git.tags=
git.total.commit.count=0

So I assume the plugin is working properly.

Nevertheless, when I get http://localhost:8080/info the result is

{"message":"Page Not Found","_links":{"self":{"href":"/info","templated":false}}}

The closest tutorial beyond the above official guidance I found is this quick guide using Micronaut version 1.0.3 and with few extra steps in Maven. Note I am using Micronaut 2.1.3 and Gradle and, the oficial guidance uses Gradle also and hasn't such few extra steps.

Here are my:

build.gradle

plugins {
    id "org.jetbrains.kotlin.jvm" version "1.4.10"
    id "org.jetbrains.kotlin.kapt" version "1.4.10"
    id "org.jetbrains.kotlin.plugin.allopen" version "1.4.10"
    id "com.github.johnrengelman.shadow" version "6.1.0"
    id "io.micronaut.application" version '1.0.5'
    id "com.gorylenko.gradle-git-properties" version "2.2.2"
}

version "0.1"
group "com.mybank"

repositories {
    mavenCentral()
    jcenter()
}

micronaut {
    runtime "netty"
    testRuntime "junit5"
    processing {
        incremental true
        annotations "com.mybank.*"
    }
}

dependencies {
    implementation("io.micronaut:micronaut-validation")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
    implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
    implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
    implementation("io.micronaut:micronaut-runtime")
    implementation("javax.annotation:javax.annotation-api")
    implementation("io.micronaut:micronaut-http-client")

    implementation("io.micronaut:micronaut-management")

    runtimeOnly("ch.qos.logback:logback-classic")
    runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")

}

mainClassName = "com.mybank.ApplicationKt"
java {
    sourceCompatibility = JavaVersion.toVersion('11')
}

compileKotlin {
    kotlinOptions {
        jvmTarget = '11'
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = '11'
    }
}

application.yml

micronaut:
  application:
    name: demo
endpoints:
  info:
    enabled: true
    sensitive: false

gradle.properties

micronautVersion=2.1.3
kotlinVersion=1.4.10

As a final goal I want to use micronaut-management to expose some built-in management and monitoring endpoints.

Jim C
  • 3,957
  • 25
  • 85
  • 162

1 Answers1

1

See the project at https://github.com/jeffbrown/jimcinfoendpoint.

I copied your build config into that project and the /info endpoint appears to work.

Jeff Scott Brown
  • 26,804
  • 2
  • 30
  • 47