我尝试使用okhttp3.logging
来记录我的改进后的http请求。
我在pom.xml
中添加了依赖项
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.1</version>
</dependency>
不幸的是,我在导入过程中遇到了一个问题:
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
以下是编译时的错误:
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
哪里出了问题?
发布于 2019-01-10 18:40:02
你可能需要
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.12.1</version>
</dependency>
发布于 2019-01-10 18:44:32
okhttp3和okhttp3的版本:需要完全匹配的日志记录拦截器依赖关系。例如:
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
发布于 2019-01-10 18:44:32
您必须咨询Maven存储库站点
https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor/3.12.1
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/logging-interceptor -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.12.1</version>
</dependency>
https://stackoverflow.com/questions/54126840
复制相似问题