com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example

元气小坏坏 提交于 2020-01-10 02:31:59

问题


I tried running the quickstart-sample, and this dependency:

<dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-drive</artifactId>
<version>v2-rev78-1.15.0-rc</version>
</dependency>

from Drive wiki API page

Yet when I try to compile the code com.google.api.client.json.jackson.JacksonFactory; is missing.
To verify this you just need to do Step 2 & 3! Where can I find this class or how can I replace it in the sample?


回答1:


Jackson library can be found at http://repo2.maven.org/maven2/com/google/http-client/google-http-client-jackson/

For July 7, last version can be obtained by Maven

<dependency>
    <groupId>com.google.http-client</groupId>
    <artifactId>google-http-client-jackson</artifactId>
    <version>1.15.0-rc</version>
</dependency>

You may also need

<dependency>
    <groupId>com.google.oauth-client</groupId>
    <artifactId>google-oauth-client-java6</artifactId>
    <version>1.15.0-rc</version>
</dependency>



回答2:


Use this class for JacksonFactory instead of the previous one.

com.google.api.client.json.jackson2.JacksonFactory




回答3:


Since version 1.11, jackson library has been moved out to separate jar to provide developers better choice of versions of each library. Please check readme.html of zip file you downloaded from google-api-java-client and you can check which specific jar file you want to include in your project.




回答4:


http://mvnrepository.com/artifact/com.google.api.client/google-api-client/1.4.1-beta

This dependency will solve your problem:

<dependency>
<groupId>com.google.api.client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.4.1-beta</version>
</dependency>



回答5:


For gradle.build =

compile group: 'com.google.http-client', name: 'google-http-client-jackson2', version: '1.11.0-beta' 


来源:https://stackoverflow.com/questions/17231722/com-google-api-client-json-jackson-jacksonfactory-missing-in-google-drive-examp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!