Reputation: 13
I am trying to use the gradle appengine plugin with my project but packages from the SDK are not being resolved.
I see many references around the web to the maven repository: com.google.appengine:appengine-api-1.0-sdk. The official documents make no reference to this and I would like to know if I should be using it with the plugin or not.
Is specifying the dependency:
compile "com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}"
An alternative to using the plugin's appengineDownloadSdk=true or downloading it manually and setting appengine.sdk.root=... ?
If I don't include that dependency (but do provide the SDK and set appengine.sdk.root OR use appengineDownloadSd/appengineSdk), I see this error when compiling
error: package com.google.appengine.api.datastore does not exist
If I do include that dependency, the compileJava task gives:
The import com.google.appengine cannot be resolved
and gives a reference to the line:
import com.google.appengine.api.datastore.DatastoreService;
from my code.
In the second case IntelliJ is able to resolve the import and can show me exactly where the SDK file is but gradle still can't seem to find it.
Upvotes: 1
Views: 898
Reputation: 2433
When using gradle, you must explicitly define all the compile dependencies. The appengineSdk
dependency is for tooling purposes only, it allows the plugin to call into the sdk for things like "update" and "run". It doesn't add any dependencies to your project
com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}
is a dependency that lets you use the appengine APIs (like datastore), so you need it to import DatastoreService
, so you definitely should be including it as a compile dependency.
Why the ide picks it up and gradle doesn't is probably a configuration problem. I tried reproducing it, but adding the dependency and referencing DatastoreService works without issue in the IDE and from the commandline. Is there anything about your configuration that could be off here?
Upvotes: 1