appengine-java-migration-samples/baseline at main · google/appengine-java-migration-samples

Visitors sample for App Engine Standard (Java 8)

This sample demonstrates how to deploy an application on Google App Engine.

See the Google App Engine standard environment documentation for more detailed instructions.

Setup

• Download and initialize the Cloud SDK

  • Create an App Engine app within the current Google Cloud Project
<plugin>
  <groupId>com.google.cloud.tools</groupId>
  <artifactId>appengine-maven-plugin</artifactId>
  <version>2.2.0</version>
  <configuration>
    <projectId>myProjectId</projectId>
    <version>GCLOUD_CONFIG</version>
  </configuration>
</plugin>

Note: GCLOUD_CONFIG is a special version for autogenerating an App Engine version. Change this field to specify a specific version name.

Maven

Running locally

mvn package appengine:run

To use visit: http://localhost:8080/

If you encounter a "no_app_id" error when running your project locally, be sure to define your project ID with the GOOGLE_CLOUD_PROJECT environment variable:

export GOOGLE_CLOUD_PROJECT=<your-project-id>

Deploying

mvn package appengine:deploy

To use vist: https://YOUR-PROJECT-ID.appspot.com

Gradle

Running locally

If you do not have gradle installed, you can run using ./gradlew appengineRun.

To use vist: http://localhost:8080/

Deploying

If you do not have gradle installed, you can deploy using ./gradlew appengineDeploy.

To use vist: https://YOUR-PROJECT-ID.appspot.com

Testing

or

As you add / modify the source code (src/main/java/...) it's very useful to add unit testing to (src/main/test/...). The following resources are quite useful: