Я пытаюсь добавить плагин springboot
buildInfo
к своему build.gradle.kts
, чтобы я мог сгенерировать файл build-info.properties
и предоставить информацию о сборке (т.е. версию приложения) через конечную точку /actuator/info
. Тем не менее, я продолжаю получать следующую ошибку при добавлении плагина buildInfo:
Unresolved reference: springBoot
Я ссылаюсь на следующую Spring документацию , но она просто говоритпросто добавить плагин и собрать.
Я помещаю плагин в нужное место в моем файле Gradle? Нужна ли мне другая зависимость или ссылка на плагин, чтобы это работало?
Вот как выглядит основная часть моего build.gradle.kts
:
group = "com.walmart.muse.core-kt"
version = getLatestTagVersion()
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
plugins {
id("org.springframework.boot") version "2.2.0.RELEASE" apply false
kotlin("jvm") version "1.3.50"
kotlin("plugin.spring") version "1.3.50"
kotlin("plugin.jpa") version "1.3.50"
kotlin("plugin.allopen") version "1.3.50"
}
// This little code block is what is causing the error.
// I want to use it to get buid-info.properties so I can hit `/actuator/info`
// to expose my build info, but this isn't working :(
springBoot {
buildInfo()
}
allprojects {
repositories {
maven(url = "https://my-company's-repository.com") // edited for privacy
}
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "java")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.jetbrains.kotlin.plugin.allopen")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "org.jetbrains.kotlin.plugin.jpa")
apply(plugin = "kotlin-spring")
dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.apache.logging.log4j:log4j-api-kotlin:1.0.0")
implementation("io.springfox:springfox-swagger2:2.7.0")
implementation("io.springfox:springfox-swagger-ui:2.7.0")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.google.code.gson:gson:2.8.4")
runtimeOnly("mysql:mysql-connector-java:5.1.6")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(module = "junit")
}
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}
allOpen {
annotation("javax.persistence.Entity")
annotation("javax.persistence.Embeddable")
annotation("javax.persistence.MappedSuperclass")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}