Issue with Importing Google Cloud API libraries on Maven Java Project (VSCode Mac)

Viewed 44

I'm having an issue importing the libraries for the Google Cloud API, I opened a default maven file and included all the appropriate dependencies in my pom.xml file (provided in the CloudCode extension on VSCode) however I keep getting the same error:

The import com.google cannot be resolved

All I'm using is the sample code provided, I'm unsure what the problem is, and I can't seem to find any resources apart from Eclipse.

package com.ootd;

import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.BucketInfo;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;

public class App {
  public static void createBucket(String projectId, String bucketName) {
    // The ID of your GCP project
    // String projectId = "your-project-id";

    // The ID to give your GCS bucket
    // String bucketName = "your-unique-bucket-name";

    Storage storage = StorageOptions.newBuilder().setProjectId(projectId).build().getService();

    Bucket bucket = storage.create(BucketInfo.newBuilder(bucketName).build());

    System.out.println("Created bucket " + bucket.getName());
  }
}

I'm not well versed in Maven, but I've set it up correctly, following step-by-step instructions. I can't see what the issue is.

How can I fix that?

0 Answers
Related