Skip to content

The import org.springframework.boot.webtestclient.AutoConfigureWebTestClient cannot be resolved #2087

@swj20010308

Description

@swj20010308

Problem

This compilation failure occurred when I tried building the project without Maven cache.

$ mvn -P spring install -am -DskipTests

will result in something like:

ActuatorDisabledHealthTest.java:[26,46] package org.springframework.boot.webtestclient does not exist

The IDE will show a slightly different error:

The import org.springframework.boot.webtestclient.AutoConfigureWebTestClient cannot be resolved

This error can be reproduced with the forked repo's CI.

Image

Potential solution

Although I cannot find any changes in the documentation for org.springframework.boot.webtestclient, the latest snapshot seems to be using a new import path

org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient

which we can verify after the failed build attempt:

$ jar -tf ~/.m2/repository/org/springframework/boot/spring-boot-webtestclient/4.0.0-SNAPSHOT/spring-boot-webtestclient-4.0.0-SNAPSHOT.jar | grep AutoConfigureWebTestClient

org/springframework/boot/webtestclient/autoconfigure/AutoConfigureWebTestClient.class
META-INF/spring/org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient.imports

Therefore the quickest fix is to update all the imports for AutoConfigureWebTestClient. With this solution the fork's CI was able to build successfully. That being said I'm not sure if the new import path can be resolved by older snapshots of spring-boot-webtestclient, so it might be necessary to clear the cache first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions