Java 包okhttp3.logging不存在

Java 包okhttp3.logging不存在,java,okhttp3,Java,Okhttp3,我尝试使用okhttp3.logging来记录我的改装http请求 我在pom.xml中添加了依赖项: <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>3.12.1</version> </dependency> 以下是编译时出现的错误: ERROR

我尝试使用
okhttp3.logging
来记录我的改装http请求

我在
pom.xml
中添加了依赖项:

<dependency>
  <groupId>com.squareup.okhttp3</groupId>
  <artifactId>okhttp</artifactId>
  <version>3.12.1</version>
</dependency>
以下是编译时出现的错误:

ERROR] /Users/martin/dev/adm/usersync/usersync-connectors/usersync-connector-discourse/src/main/java/org/xwiki/contrib/usersync/discourse/internal/DiscourseUserSyncConnector.java:[84,48] package HttpLoggingInterceptor does not exist
出什么问题了?

您可能需要

<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>logging-interceptor</artifactId>
    <version>3.12.1</version>
</dependency>

com.squareup.okhttp3
日志拦截器
3.12.1
您可能需要

<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>logging-interceptor</artifactId>
    <version>3.12.1</version>
</dependency>

com.squareup.okhttp3
日志拦截器
3.12.1

okhttp3和okhttp3的版本:记录拦截器依赖项需要完全匹配。例如:

compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'

okhttp3和okhttp3:logging拦截器依赖项的版本需要完全匹配。例如:

compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'

您必须咨询Maven存储库站点


com.squareup.okhttp3
日志拦截器
3.12.1

您必须咨询Maven存储库站点


com.squareup.okhttp3
日志拦截器
3.12.1

这对我很有效:在gradle文件中更改下一个配置

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

这对我很有用:在gradle文件中更改下一个配置

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}