0

コードには以下のように記述されています。

import org.springframework.boot.actuate.metrics.web.client.MetricsRestTemplateCustomizer;

ビルドしようとすると以下のようなエラーになります。

error: package org.springframework.boot.actuate.metrics.web.client does not exist

エラーを見ると、actuateより先が解決できないようです。(actuateのaの下に^が表示されます。)

build.gradleは以下のような内容です。(明らかに無関係な箇所は省略しています)

plugins {
    id 'org.springframework.boot' version '2.1.2.RELEASE'
    id 'io.spring.dependency-management' version '1.0.6.RELEASE'
}

group = 'jp.co.test.sample'
version = '0.0.1'
sourceCompatibility = JavaVersion.VERSION_11

repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
}

dependencies {
    implementation "org.springframework.boot:spring-boot-starter-actuator"
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.cloud:spring-cloud-stream'
    implementation 'org.springframework.retry:spring-retry:1.2.4.RELEASE'
    implementation "io.micrometer:micrometer-registry-prometheus:1.3.2"
}

どうすれば、org.springframework.boot.actuateをimportできるようになりますか?

3
  • 私の環境で書かれている設定を再現してみましたが問題無さそうでした。 gradle dependencies --configuration compileClasspath コマンドで依存関係を出力できますが、その中に org.springframework.boot:spring-boot-actuator:2.1.2.RELEASE は含まれているでしょうか。 2020年4月17日 3:14
  • 返信遅れてしまい申し訳ありません。 含まれているようでした。
    – user39667
    2020年4月20日 0:28
  • Gradleのキャッシュ を削除/一時退避させて実行してみるとどうなるでしょうか(キャッシュディレクトリは ~/.gradle/caches/modules-2/files-2.1です)。 2020年4月20日 5:17

0

この質問に回答するには、ログインする必要があります。

のタグが付いた他の質問を参照する。