Skip to content

Commit 69a28d3

Browse files
author
Shun Fan
committed
Merge pull request #41 from GoogleCloudPlatform/helloworld
Update to conform to appengine java runtime
2 parents aa25088 + bce221c commit 69a28d3

File tree

5 files changed

+34
-25
lines changed

5 files changed

+34
-25
lines changed

appengine/helloworld/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Appengine Helloworld sample for Google App Engine
2+
This sample demonstrates how to deploy an application on Google App Engine
3+
## Setup
4+
1. Update the <application> tag in src/main/webapp/WEB-INF/appengine-web.xml with your project name
5+
1. Update the <version> tag in src/main/webapp/WEB-INF/appengine-web.xml with your version name
6+
7+
## Running locally
8+
$ mvn appengine:devserver
9+
10+
## Deploying
11+
$ mvn appengine:update

appengine/helloworld/pom.xml

+5-16
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ Copyright 2015 Google Inc. All Rights Reserved.
1919
<modelVersion>4.0.0</modelVersion>
2020
<packaging>war</packaging>
2121
<version>1.0-SNAPSHOT</version>
22-
<groupId>com.example.appengine.gettingstartedjava</groupId>
22+
<groupId>com.example.appengine</groupId>
2323
<artifactId>helloworld</artifactId>
2424
<dependencies>
2525
<dependency>
2626
<groupId>javax.servlet</groupId>
27-
<artifactId>javax.servlet-api</artifactId>
28-
<version>3.1.0</version>
27+
<artifactId>servlet-api</artifactId>
28+
<version>2.5</version>
2929
<type>jar</type>
3030
<scope>provided</scope>
3131
</dependency>
@@ -34,14 +34,6 @@ Copyright 2015 Google Inc. All Rights Reserved.
3434
<!-- for hot reload of the web application -->
3535
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
3636
<plugins>
37-
<plugin>
38-
<groupId>org.apache.maven.plugins</groupId>
39-
<artifactId>maven-war-plugin</artifactId>
40-
<version>2.6</version>
41-
<configuration>
42-
<failOnMissingWebXml>false</failOnMissingWebXml>
43-
</configuration>
44-
</plugin>
4537
<plugin>
4638
<groupId>org.apache.maven.plugins</groupId>
4739
<version>3.3</version>
@@ -53,11 +45,8 @@ Copyright 2015 Google Inc. All Rights Reserved.
5345
</plugin>
5446
<plugin>
5547
<groupId>com.google.appengine</groupId>
56-
<artifactId>gcloud-maven-plugin</artifactId>
57-
<version>2.0.9.84.v20151031</version>
58-
<configuration>
59-
<set_default>true</set_default>
60-
</configuration>
48+
<artifactId>appengine-maven-plugin</artifactId>
49+
<version>1.9.28</version>
6150
</plugin>
6251
</plugins>
6352
</build>
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,19 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.example.appengine.gettingstartedjava.helloworld;
17+
package com.example.appengine.helloworld;
1818

1919
import java.io.IOException;
2020
import java.io.PrintWriter;
2121

22-
import javax.servlet.annotation.WebServlet;
2322
import javax.servlet.http.HttpServlet;
2423
import javax.servlet.http.HttpServletRequest;
2524
import javax.servlet.http.HttpServletResponse;
2625

2726
// [START example]
28-
@WebServlet(name = "helloworld", urlPatterns = { "/*" })
27+
@SuppressWarnings("serial")
2928
public class HelloServlet extends HttpServlet {
3029

31-
private static final long serialVersionUID = 1L;
32-
3330
@Override
3431
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
3532
PrintWriter out = resp.getWriter();
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
3+
<application>YOUR-PROJECT-ID</application>
4+
<version>YOUR-VERSION-ID</version>
35
<threadsafe>true</threadsafe>
4-
<!-- TODO remove beta-settings -->
5-
<beta-settings>
6-
<setting name="java_quickstart" value="true" />
7-
</beta-settings>
86
</appengine-web-app>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
3+
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
4+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
5+
version="2.5">
6+
<servlet>
7+
<servlet-name>hello</servlet-name>
8+
<servlet-class>com.example.appengine.helloworld.HelloServlet</servlet-class>
9+
</servlet>
10+
<servlet-mapping>
11+
<servlet-name>hello</servlet-name>
12+
<url-pattern>/</url-pattern>
13+
</servlet-mapping>
14+
</web-app>

0 commit comments

Comments
 (0)