gpt4 book ai didi

gradle - 从gradle-git-properties/micronaut-management获取/info时找不到页面

转载 作者:行者123 更新时间:2023-12-03 05:02:52 39 4
gpt4 key购买 nike

上下文:我从https://micronaut.io/launch/下载了一个初始化的项目,并添加了gradle-git-properties插件和micronaut-management依赖项,以公开git.properties,如adding commit info guide中所述
我检查了我的项目buil / resources / main,然后看到了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
因此,我认为插件可以正常工作。
不过,当我得到http:// localhost:8080 / info时,结果是
{"message":"Page Not Found","_links":{"self":{"href":"/info","templated":false}}}
除了上述官方指导之外,我找到的最接近的教程是使用Micronaut 1.0.3版的 this quick guide ,在Maven中几乎没有其他步骤。注意我正在使用Micronaut 2.1.3和Gradle,并且官方指南也使用Gradle,并且没有太多额外的步骤。
这是我的:
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
作为最终目标,我想使用微导航管理来公开一些内置的管理和监视端点。

最佳答案

请参阅https://github.com/jeffbrown/jimcinfoendpoint上的项目。
我将您的构建配置复制到该项目中,并且/info端点似乎可以正常工作。

关于gradle - 从gradle-git-properties/micronaut-management获取/info时找不到页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64733176/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com