Reputation: 20465
After upgrade to Spring Boot 3.4.0 from 3.3.x, I get an error
Cannot resolve com.squareup.okhttp3:mockwebserver:unknown
My project uses okhttp3.mockwebserver.MockWebServer
and has the dependency
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<scope>test</scope>
</dependency>
Upvotes: 2
Views: 973
Reputation: 20465
The reason is described in the Spring Boot 3.4 Release Notes:
OkHttp Dependency Management Removed
Spring Boot no longer depends on OkHttp so it no longer manages its version. If your application has OkHttp dependencies, update its build to use an OkHttp version that meets its needs.
It means that until the version 3.3.x, the Spring Boot Dependencies BOM spring-boot-dependencies-3.3.5.pom
contained the dependency management:
<properties>
...
<okhttp.version>4.12.0</okhttp.version>
...
</properties>
...
<dependencyManagement>
...
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-bom</artifactId>
<version>${okhttp.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
...
</dependencyManagement>
What you need to do now is to add the version explicitly to your pom.xml
:
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.12.0</version>
<scope>test</scope>
</dependency>
Upvotes: 6