title: maven "cannot find symbol" jackson2.JacksonFactory
body: <p>I'm trying to access the <strong>google sheets api</strong> via maven,
  Unfortunately I have an error compiling maven</p>
  
  <p>here is my pom file:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;BotSheets&lt;/groupId&gt;
  &lt;artifactId&gt;b&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;b&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;!-- Build an executable JAR --&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                          &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                          &lt;mainClass&gt;BotSheets.b.GoogleSheetAPI&lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
  &lt;/properties&gt;
  
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit-dep&lt;/artifactId&gt;
          &lt;version&gt;4.11&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.api-client&lt;/groupId&gt;
          &lt;artifactId&gt;google-api-client&lt;/artifactId&gt;
          &lt;version&gt;1.22.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.oauth-client&lt;/groupId&gt;
          &lt;artifactId&gt;google-oauth-client-jetty&lt;/artifactId&gt;
          &lt;version&gt;1.22.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.apis&lt;/groupId&gt;
          &lt;artifactId&gt;google-api-services-sheets&lt;/artifactId&gt;
          &lt;version&gt;v4-rev483-1.22.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.testng&lt;/groupId&gt;
          &lt;artifactId&gt;testng&lt;/artifactId&gt;
          &lt;version&gt;6.10&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
          &lt;version&gt;3.4.0&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p>my tree file:</p>
  
  <pre><code>    ├── pom.xml
  ├── src
  │   ├── main
  │   │   └── java
  │   │       └── BotSheets
  │   │           └── b
  │   │               ├── client_secret.json
  │   │               └── GoogleSheetAPI.java
  │   └── test
  │       └── java
  │           └── BotSheets
  │               └── b
  │                   └── AppTest.java
  </code></pre>
  
  <p>my code:</p>
  
  <pre><code>package BotSheets.b;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.util.Arrays;
  import java.util.List;
  
  import com.google.api.client.auth.oauth2.Credential;
  import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
  import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
  import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
  import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
  import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
  import com.google.api.client.http.HttpTransport;
  import com.google.api.client.json.JsonFactory;
  import com.google.api.client.json.jackson2.JacksonFactory;
  import com.google.api.client.util.store.FileDataStoreFactory;
  import com.google.api.services.sheets.v4.Sheets;
  import com.google.api.services.sheets.v4.SheetsScopes;
  import com.google.api.services.sheets.v4.model.ValueRange;
  
      public class GoogleSheetAPI {
          /** Application name. */
          private static final String APPLICATION_NAME = "Google Sheets API Java Quickstart";
  
          /** Directory to store user credentials for this application. */
          private static final java.io.File DATA_STORE_DIR = new java.io.File(
              System.getProperty("user.home"), ".credentials/sheets.googleapis.com-java-quickstart");
  
          /** Global instance of the {@link FileDataStoreFactory}. */
          private static FileDataStoreFactory DATA_STORE_FACTORY;
  
          /** Global instance of the JSON factory. */
          private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
  
          /** Global instance of the HTTP transport. */
          private static HttpTransport HTTP_TRANSPORT;
  
          /** Global instance of the scopes required by this quickstart.
           *
           * If modifying these scopes, delete your previously saved credentials
           * at ~/.credentials/sheets.googleapis.com-java-quickstart
           */
          private static final List&lt;String&gt; SCOPES = Arrays.asList(SheetsScopes.SPREADSHEETS_READONLY);
  
          static {
              try {
                  HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
                  DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR);
              } catch (Throwable t) {
                  t.printStackTrace();
                  System.exit(1);
              }
          }
  
          /**
           * Creates an authorized Credential object.
           * @return an authorized Credential object.
           * @throws IOException
           */
          public static Credential authorize() throws IOException {
              // Load client secrets.
              InputStream in =
              GoogleSheetAPI.class.getResourceAsStream("/client_secret.json");
              GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
  
              // Build flow and trigger user authorization request.
              GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
                      .setDataStoreFactory(DATA_STORE_FACTORY)
                      .setAccessType("offline")
                      .build();
              Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
              System.out.println("Credentials saved to " + DATA_STORE_DIR.getAbsolutePath());
              return credential;
          }
  
          /**
           * Build and return an authorized Sheets API client service.
           * @return an authorized Sheets API client service
           * @throws IOException
           */
          public static Sheets getSheetsService() throws IOException {
              Credential credential = authorize();
              return new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
                      .setApplicationName(APPLICATION_NAME)
                      .build();
          }
  
          public List&lt;List&lt;Object&gt;&gt; getSpreadSheetRecords(String spreadsheetId, String range) throws IOException {
              Sheets service = getSheetsService();        
              ValueRange response = service.spreadsheets().values()
                      .get(spreadsheetId, range)
                      .execute();
              List&lt;List&lt;Object&gt;&gt; values = response.getValues();
              if (values != null &amp;&amp; values.size() != 0) {
                  return values;
              } else {
                  System.out.println("No data found.");
                  return null;
              }
          }
      }
  </code></pre>
  
  <p>I would be happy to help,
  That's the error I got:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project b: Compilation failure: Compilation failure: 
  [ERROR] /home/*/eclipse-workspace/b/src/main/java/BotSheets/b/GoogleSheetAPI.java:[17,43] package com.google.api.client.json.jackson2 does not exist
  [ERROR] /home/*/eclipse-workspace/b/src/main/java/BotSheets/b/GoogleSheetAPI.java:[35,53] cannot find symbol
  [ERROR]   symbol:   variable JacksonFactory
  [ERROR]   location: class BotSheets.b.GoogleSheetAPI
  </code></pre>
  
  <p>The Java version is 10.0.1</p>
  
  <p>I tried some stuff but without big success.
  this code I copy from <a href="http://www.seleniumeasy.com/selenium-tutorials/read-data-from-google-spreadsheet-using-api" rel="nofollow noreferrer">http://www.seleniumeasy.com/selenium-tutorials/read-data-from-google-spreadsheet-using-api</a></p>