Oliver Hausler
Oliver Hausler

Reputation: 4987

Google Cloud Storage Java Client Library with Gradle

Google promotes their new Java Client library here: https://developers.google.com/appengine/docs/java/googlecloudstorageclient/

Note: I am not talking about the native REST library. I want to work with the Java Client Library.

On the website, Google does not specify the import directive for Gradle. For Maven, pom.xml looks like this:

<dependency>
    <groupId>com.google.appengine.tools</groupId>
    <artifactId>appengine-gcs-client</artifactId>
    <version>RELEASE</version>
</dependency>

When I change this to work with my Gradle project, it doesn't work:

dependencies {
    compile 'com.google.appengine.tools:appengine-gcs-client:RELEASE'
}

It finds the tools there, but the com.google.appengine.tools.cloudstorage cannot be resolved (it resolves tools, though).

What I did then: I removed the library and seached for "gcs" in the Android Studio dependencies dialog; and it finds and adds the following directive to build.gradle:

dependencies {
    compile 'com.google.appengine.tools:appengine-gcs-client:0.3.9@jar'
}

Same problem with that as before: tools is resolved, but not tools.cloudstorage.

I don't want to download the jar as I want my project to update jars automatically. mavenCentral() is set, and here is my full build.gradle file, just in case you need it:

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.appengine.tools:appengine-gcs-client:0.3.9@jar'
    compile 'com.google.http-client:google-http-client-android:1.18.0-rc'
}

Any help appreciated, thanks!

Upvotes: 7

Views: 2438

Answers (1)

Jim Vitek
Jim Vitek

Reputation: 4214

You can use the following to specify version 0.4.4 (the most recent as of 1/14/2015):

compile 'com.google.appengine.tools:appengine-gcs-client:0.4.4'

or specify the latest version with a plus sign:

compile 'com.google.appengine.tools:appengine-gcs-client:+'

Using the latter is the faster answer, but it may cause unintended compatibility issues in the future as updates are release.

Upvotes: 4

Related Questions