How to import Google Cloud Client Library in Java

Question

How would one import the Google Cloud Client Library found at : http://googlecloudplatform.github.io/google-cloud-java/0.8.0/index.html

Into eclipse, non maven, java?

I have found no .jar file in the library.

EDIT:

I tried adding the .jar file but I still get "the import could not be resolved" on the following imports:

import com.google.gcloud.AuthCredentials;
import com.google.gcloud.datastore.Datastore;
import com.google.gcloud.datastore.DatastoreOptions;
import com.google.gcloud.datastore.Entity;
import com.google.gcloud.datastore.Key;
import com.google.gcloud.datastore.KeyFactory;

Show source
| java   | eclipse   | google-cloud-platform   2017-01-03 13:01 2 Answers

Answers ( 2 )

  1. 2017-01-03 13:01

    Get JAR file from maven central, for example for 0.8 version here is download link. And then add JAR to your Eclipse project as usual.

  2. 2017-01-03 14:01

    Just download it from Maven Central, even if you do not want to use some proper build tool like Gradle or even Maven: https://repo1.maven.org/maven2/com/google/cloud/google-cloud/0.8.0/google-cloud-0.8.0.jar

    As you do not want to use a proper build tool with transitive dependency management (like Gradle, Ant+Ivy, Maven in best-to-worst order) you of course also have to add all transitive dependencies manually. Look into the POM file of the library at https://repo1.maven.org/maven2/com/google/cloud/google-cloud/0.8.0/google-cloud-0.8.0.pom and also download and add all dependencies and their dependencies and their dependencies.

    The google-cloud-0.8.0.jar is just an empty placeholder, so you cannot use something by just importing that JAR of course.

    com.google.gcloud.AuthCredentials for example is actually contained in gcloud-java-core and com.google.gcloud.datastore.Datastore in gcloud-java-datastore. If you are interested in which JAR contains an actual class file you can easily use the Maven Central search for this like http://search.maven.org/#search%7Cga%7C1%7Cfc%3Acom.google.gcloud.datastore.Datastore

◀ Go back