Skip to content

Commit 90988e8

Browse files
authored
---
yaml --- r: 5465 b: refs/heads/master c: 7a310c4 h: refs/heads/master i: 5463: c16080d
1 parent c87cc58 commit 90988e8

4 files changed

Lines changed: 46 additions & 2 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3919d63a5ff030a522ad07d5a46c3251998795e6
2+
refs/heads/master: 7a310c47d19dcfe71966276fe18a20914f332192
33
refs/heads/travis: dae77e558b884bc1b165155482d76c8e40b0fca4
44
refs/heads/gh-pages: 4936f6d1c43be1ab76229d2743bae07f4b4124b3
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

trunk/APPENGINE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Use Google Cloud Java Client with Google App Engine
2+
=================================================
3+
4+
Quickstart
5+
----------
6+
This file provides extra instructions to set up Google Cloud Java Client with Google App Engine.
7+
8+
See [Google Cloud JavaQuickstart](./README.md#quickstart) for general instructions on using Google Cloud Java.
9+
10+
See [Quickstart for App Engine Standard Environment for Java](https://cloud.google.com/appengine/docs/standard/java/quickstart) for extra Google App Engine instructions.
11+
12+
If you are using Maven, add this to your pom.xml file
13+
```xml
14+
<dependency>
15+
<groupId>com.google.appengine</groupId>
16+
<artifactId>appengine-api-1.0-sdk</artifactId>
17+
<version>1.9.50</version>
18+
</dependency>
19+
```
20+
21+
If you are using Gradle, add this to your dependencies
22+
```Groovy
23+
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.50'
24+
```
25+
If you are using SBT, add this to your dependencies
26+
```Scala
27+
libraryDependencies += "com.google.appengine" % "appengine-api-1.0-sdk" % "1.9.50"
28+
```
29+
30+
To test with local dev server, run
31+
```
32+
mvn appengine:devserver
33+
```

trunk/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ If you are using SBT, add this to your dependencies
5757
libraryDependencies += "com.google.cloud" % "google-cloud" % "0.9.4-alpha"
5858
```
5959

60+
For running on Google App Engine, see [more instructions here](./APPENGINE.md).
61+
6062
Example Applications
6163
--------------------
6264

trunk/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,17 @@ protected static String getAppEngineProjectId() {
394394
String serviceAccountName = (String) method.invoke(appIdentityService);
395395
int indexOfAtSign = serviceAccountName.indexOf('@');
396396
return serviceAccountName.substring(0, indexOfAtSign);
397+
} catch (ClassNotFoundException exception) {
398+
if (System.getProperty("com.google.appengine.runtime.version") != null) {
399+
// Could not resolve appengine classes under GAE environment.
400+
throw new RuntimeException("Google App Engine runtime detected "
401+
+ "(the environment variable \"com.google.appengine.runtime.version\" is set), "
402+
+ "but unable to resolve appengine-sdk classes. "
403+
+ "For more details see "
404+
+ "https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/APPENGINE.md");
405+
}
406+
return null;
397407
} catch (Exception ignore) {
398-
// return null if can't determine
399408
return null;
400409
}
401410
}

0 commit comments

Comments
 (0)