Skip to content

Commit bac40f1

Browse files
ludochdpebot
authored andcommitted
Preparing GAE Java8 Standard doc samples. (#494)
* Preparing GAE Java8 Standard doc samples. * Remove snapshot dependency, and fix formatting. * Remove snapshot dependency, and fix formatting. * Fix formatting.
1 parent 120d40c commit bac40f1

File tree

48 files changed

+164
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+164
-145
lines changed

java8-appengine/analytics/pom.xml

+13-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<packaging>war</packaging>
1919
<version>1.0-SNAPSHOT</version>
2020
<groupId>com.example.appengine</groupId>
21-
<artifactId>appengine-analytics</artifactId>
21+
<artifactId>appengine-analytics-java8</artifactId>
2222

2323
<parent>
2424
<artifactId>doc-samples</artifactId>
@@ -29,8 +29,8 @@
2929
<!-- Parent POM defines ${appengine.sdk.version} (updates frequently). -->
3030

3131
<properties>
32-
<maven.compiler.target>1.7</maven.compiler.target>
33-
<maven.compiler.source>1.7</maven.compiler.source>
32+
<maven.compiler.target>1.8</maven.compiler.target>
33+
<maven.compiler.source>1.8</maven.compiler.source>
3434
</properties>
3535

3636
<dependencies>
@@ -45,8 +45,8 @@
4545
</dependency>
4646
<dependency>
4747
<groupId>javax.servlet</groupId>
48-
<artifactId>servlet-api</artifactId>
49-
<version>2.5</version>
48+
<artifactId>javax.servlet-api</artifactId>
49+
<version>3.1.0</version>
5050
<type>jar</type>
5151
<scope>provided</scope>
5252
</dependency>
@@ -61,6 +61,14 @@
6161
<artifactId>appengine-maven-plugin</artifactId>
6262
<version>${appengine.sdk.version}</version>
6363
</plugin>
64+
<plugin>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<artifactId>maven-war-plugin</artifactId>
67+
<version>2.6</version>
68+
<configuration>
69+
<failOnMissingWebXml>false</failOnMissingWebXml>
70+
</configuration>
71+
</plugin>
6472
</plugins>
6573
</build>
6674
</project>

java8-appengine/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java

+2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@
2727
import java.net.URL;
2828

2929
import javax.servlet.ServletException;
30+
import javax.servlet.annotation.WebServlet;
3031
import javax.servlet.http.HttpServlet;
3132
import javax.servlet.http.HttpServletRequest;
3233
import javax.servlet.http.HttpServletResponse;
3334

3435
// [START example]
3536
@SuppressWarnings("serial")
37+
@WebServlet(name = "analytics", urlPatterns = {"/"})
3638
public class AnalyticsServlet extends HttpServlet {
3739

3840
@Override

java8-appengine/analytics/src/main/webapp/WEB-INF/appengine-web.xml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1717
<application>YOUR-PROJECT-ID</application>
1818
<version>YOUR-VERSION-ID</version>
19+
<runtime>java8</runtime>
1920
<threadsafe>true</threadsafe>
2021
<env-variables>
2122
<env-var name="GA_TRACKING_ID" value="YOUR-GA-TRACKING-ID" />

java8-appengine/analytics/src/main/webapp/WEB-INF/web.xml

-29
This file was deleted.

java8-appengine/appidentity/pom.xml

+13-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<packaging>war</packaging>
1919
<version>1.0-SNAPSHOT</version>
2020
<groupId>com.example.appengine</groupId>
21-
<artifactId>appengine-appidentity</artifactId>
21+
<artifactId>appengine-appidentity-java8</artifactId>
2222

2323
<parent>
2424
<groupId>com.google.cloud</groupId>
@@ -44,8 +44,8 @@
4444
</dependency>
4545
<dependency>
4646
<groupId>javax.servlet</groupId>
47-
<artifactId>servlet-api</artifactId>
48-
<version>2.5</version>
47+
<artifactId>javax.servlet-api</artifactId>
48+
<version>3.1.0</version>
4949
<type>jar</type>
5050
<scope>provided</scope>
5151
</dependency>
@@ -99,8 +99,16 @@
9999
<plugins>
100100
<plugin>
101101
<groupId>com.google.appengine</groupId>
102-
<artifactId>gcloud-maven-plugin</artifactId>
103-
<version>${gcloud-maven-plugin-version}</version>
102+
<artifactId>appengine-maven-plugin</artifactId>
103+
<version>${appengine.sdk.version}</version>
104+
</plugin>
105+
<plugin>
106+
<groupId>org.apache.maven.plugins</groupId>
107+
<artifactId>maven-war-plugin</artifactId>
108+
<version>2.6</version>
109+
<configuration>
110+
<failOnMissingWebXml>false</failOnMissingWebXml>
111+
</configuration>
104112
</plugin>
105113
</plugins>
106114
</build>

java8-appengine/channel/pom.xml

+14-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<packaging>war</packaging>
1919
<version>1.0-SNAPSHOT</version>
2020
<groupId>com.example.appengine</groupId>
21-
<artifactId>appengine-channel</artifactId>
21+
<artifactId>appengine-channel-java8</artifactId>
2222
<parent>
2323
<groupId>com.google.cloud</groupId>
2424
<artifactId>doc-samples</artifactId>
@@ -40,11 +40,11 @@
4040
<version>${appengine.sdk.version}</version>
4141
</dependency>
4242
<dependency>
43-
<groupId>javax.servlet</groupId>
44-
<artifactId>servlet-api</artifactId>
45-
<version>2.5</version>
46-
<type>jar</type>
47-
<scope>provided</scope>
43+
<groupId>javax.servlet</groupId>
44+
<artifactId>javax.servlet-api</artifactId>
45+
<version>3.1.0</version>
46+
<type>jar</type>
47+
<scope>provided</scope>
4848
</dependency>
4949
<dependency>
5050
<groupId>org.json</groupId>
@@ -106,6 +106,14 @@
106106
<artifactId>appengine-maven-plugin</artifactId>
107107
<version>${appengine.sdk.version}</version>
108108
</plugin>
109+
<plugin>
110+
<groupId>org.apache.maven.plugins</groupId>
111+
<artifactId>maven-war-plugin</artifactId>
112+
<version>2.6</version>
113+
<configuration>
114+
<failOnMissingWebXml>false</failOnMissingWebXml>
115+
</configuration>
116+
</plugin>
109117
</plugins>
110118
</build>
111119
</project>

java8-appengine/cloudsql/pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<packaging>war</packaging>
1919
<version>1.0-SNAPSHOT</version>
2020
<groupId>com.example.appengine</groupId>
21-
<artifactId>appengine-cloudsql</artifactId>
21+
<artifactId>appengine-cloudsql-java8</artifactId>
2222

2323
<parent>
2424
<artifactId>doc-samples</artifactId>
@@ -41,16 +41,16 @@
4141

4242
<!-- [START_EXCLUDE] -->
4343
<appengine.maven.plugin>1.0.0</appengine.maven.plugin>
44-
<maven.compiler.target>1.7</maven.compiler.target>
45-
<maven.compiler.source>1.7</maven.compiler.source>
44+
<maven.compiler.target>1.8</maven.compiler.target>
45+
<maven.compiler.source>1.8</maven.compiler.source>
4646
<!-- [END_EXCLUDE] -->
4747
</properties>
4848
<!-- [END properties] -->
4949
<dependencies>
5050
<dependency>
5151
<groupId>javax.servlet</groupId>
52-
<artifactId>servlet-api</artifactId>
53-
<version>2.5</version>
52+
<artifactId>javax.servlet-api</artifactId>
53+
<version>3.1.0</version>
5454
<scope>provided</scope>
5555
</dependency>
5656

java8-appengine/datastore/indexes-exploding/src/main/webapp/WEB-INF/appengine-web.xml

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1818
<application>YOUR-PROJECT-ID</application>
1919
<version>YOUR-VERSION-ID</version>
20+
<runtime>java8</runtime>
2021
<threadsafe>true</threadsafe>
2122
</appengine-web-app>

java8-appengine/datastore/indexes-perfect/src/main/webapp/WEB-INF/appengine-web.xml

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1818
<application>YOUR-PROJECT-ID</application>
1919
<version>YOUR-VERSION-ID</version>
20+
<runtime>java8</runtime>
2021
<threadsafe>true</threadsafe>
2122
</appengine-web-app>

java8-appengine/datastore/indexes/src/main/webapp/WEB-INF/appengine-web.xml

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1818
<application>YOUR-PROJECT-ID</application>
1919
<version>YOUR-VERSION-ID</version>
20+
<runtime>java8</runtime>
2021
<threadsafe>true</threadsafe>
2122
</appengine-web-app>

java8-appengine/datastore/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<packaging>war</packaging>
1919
<version>1.0-SNAPSHOT</version>
2020
<groupId>com.example.appengine</groupId>
21-
<artifactId>appengine-datastore</artifactId>
21+
<artifactId>appengine-datastore-java8</artifactId>
2222

2323
<parent>
2424
<groupId>com.google.cloud</groupId>
@@ -36,8 +36,8 @@
3636

3737
<dependency>
3838
<groupId>javax.servlet</groupId>
39-
<artifactId>servlet-api</artifactId>
40-
<version>2.5</version>
39+
<artifactId>javax.servlet-api</artifactId>
40+
<version>3.1.0</version>
4141
<scope>provided</scope>
4242
</dependency>
4343

java8-appengine/datastore/src/main/webapp/WEB-INF/appengine-web.xml

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1717
<application>YOUR-PROJECT-ID</application>
1818
<version>YOUR-VERSION-ID</version>
19+
<runtime>java8</runtime>
1920
<threadsafe>true</threadsafe>
2021
</appengine-web-app>

java8-appengine/firebase-tictactoe/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<packaging>war</packaging>
1919
<version>1.0-SNAPSHOT</version>
2020
<groupId>com.example.appengine</groupId>
21-
<artifactId>appengine-firebase-tictactoe</artifactId>
21+
<artifactId>appengine-firebase-tictactoe-java8</artifactId>
2222
<parent>
2323
<groupId>com.google.cloud</groupId>
2424
<artifactId>doc-samples</artifactId>
@@ -49,8 +49,8 @@
4949
</dependency>
5050
<dependency>
5151
<groupId>javax.servlet</groupId>
52-
<artifactId>servlet-api</artifactId>
53-
<version>${servlet-api.version}</version>
52+
<artifactId>javax.servlet-api</artifactId>
53+
<version>3.1.0</version>
5454
<type>jar</type>
5555
<scope>provided</scope>
5656
</dependency>

java8-appengine/guestbook-cloud-datastore/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<version>1.0-SNAPSHOT</version>
99

1010
<groupId>com.example.appengine</groupId>
11-
<artifactId>appengine-guestbook-cloud-datastore</artifactId>
11+
<artifactId>appengine-guestbook-cloud-datastore-java8</artifactId>
1212
<properties>
1313
<guava.version>19.0</guava.version>
1414
</properties>
@@ -34,8 +34,8 @@
3434
</dependency>
3535
<dependency>
3636
<groupId>javax.servlet</groupId>
37-
<artifactId>servlet-api</artifactId>
38-
<version>2.5</version>
37+
<artifactId>javax.servlet-api</artifactId>
38+
<version>3.1.0</version>
3939
<scope>provided</scope>
4040
</dependency>
4141
<dependency>
@@ -47,7 +47,7 @@
4747
<dependency>
4848
<groupId>com.google.cloud</groupId>
4949
<artifactId>google-cloud</artifactId>
50-
<version>0.4.0</version>
50+
<version>0.8.0</version>
5151
</dependency>
5252

5353
<dependency>

java8-appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
import com.google.cloud.datastore.QueryResults;
99
import com.google.cloud.datastore.testing.LocalDatastoreHelper;
1010
import com.google.common.collect.Lists;
11+
import org.joda.time.Duration;
1112

1213
import java.io.IOException;
1314
import java.util.ArrayList;
15+
import java.util.concurrent.TimeoutException;
1416

1517
public class TestUtils {
1618
static LocalDatastoreHelper datastore = LocalDatastoreHelper.create();
@@ -26,9 +28,9 @@ public static void startDatastore() {
2628

2729
public static void stopDatastore() {
2830
try {
29-
datastore.stop();
31+
datastore.stop(Duration.millis(10000));
3032
Persistence.setDatastore(null);
31-
} catch (IOException | InterruptedException e) {
33+
} catch (IOException | InterruptedException | TimeoutException e) {
3234
throw new RuntimeException(e);
3335
}
3436
}

java8-appengine/guestbook-objectify/pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<version>1.0-SNAPSHOT</version>
77

88
<groupId>com.example.appengine</groupId>
9-
<artifactId>appengine-guestbook-objectify</artifactId>
9+
<artifactId>appengine-guestbook-objectify-java8</artifactId>
1010
<properties>
1111
<objectify.version>5.1.14</objectify.version>
1212
<guava.version>20.0</guava.version>
@@ -32,10 +32,10 @@
3232
<version>${appengine.sdk.version}</version>
3333
</dependency>
3434
<dependency>
35-
<groupId>javax.servlet</groupId>
36-
<artifactId>servlet-api</artifactId>
37-
<version>2.5</version>
38-
<scope>provided</scope>
35+
<groupId>javax.servlet</groupId>
36+
<artifactId>javax.servlet-api</artifactId>
37+
<version>3.1.0</version>
38+
<scope>provided</scope>
3939
</dependency>
4040
<dependency>
4141
<groupId>jstl</groupId>

java8-appengine/helloworld-new-plugins/pom.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ Copyright 2015 Google Inc. All Rights Reserved.
1919
<packaging>war</packaging>
2020
<version>1.0-SNAPSHOT</version>
2121
<groupId>com.example.appengine</groupId>
22-
<artifactId>appengine-helloworld-newplugins</artifactId>
22+
<artifactId>appengine-helloworld-java8-newplugins</artifactId>
2323

2424
<!-- [START compiler] -->
25-
<properties> <!-- App Engine Standard currently requires Java 7 -->
26-
<maven.compiler.target>1.7</maven.compiler.target>
27-
<maven.compiler.source>1.7</maven.compiler.source>
25+
<properties>
26+
<maven.compiler.target>1.8</maven.compiler.target>
27+
<maven.compiler.source>1.8</maven.compiler.source>
2828
</properties>
2929
<!-- [END compiler] -->
3030

@@ -38,8 +38,8 @@ Copyright 2015 Google Inc. All Rights Reserved.
3838
<dependencies>
3939
<dependency>
4040
<groupId>javax.servlet</groupId>
41-
<artifactId>servlet-api</artifactId>
42-
<version>2.5</version>
41+
<artifactId>javax.servlet-api</artifactId>
42+
<version>3.1.0</version>
4343
<type>jar</type>
4444
<scope>provided</scope>
4545
</dependency>

0 commit comments

Comments
 (0)