我正在尝试使用MAON中的GSON将JSON转换为JAVA对象,我正在关注youtube视频以获得指导 - https://www.youtube.com/watch?v=Vqgghm9pWe0,但是在主类中出现错误时出现错误 - 包com.squareup.okhttp3不存在。代码如下:
Java
package com.codebeasty.json;
import com.squareup.okhttp3.OkHttpClient;
public class Main {
private static OkHttpClient client = new OkHttpClient();
public static void main (String [] args)
{
}
}
我甚至在pom.xml中加入了依赖:
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
我不明白为什么它不能识别com.squareup。我可能需要下载一些额外的东西吗?我已从此网站下载了JAR - http://square.github.io/okhttp/,并尝试使用依赖项构建项目。请帮忙:(