App Engine SparkJava with Java8 === ## Sample written in SparkJava for use with App Engine Java8 Standard. See the [Google App Engine standard environment documentation][ae-docs] for more detailed instructions. [ae-docs]: https://cloud.google.com/appengine/docs/java/ * [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [Maven](https://maven.apache.org/download.cgi) (at least 3.5) * [Google Cloud SDK](https://cloud.google.com/sdk/) (aka gcloud command line tool) ## Setup * Download and initialize the [Cloud SDK](https://cloud.google.com/sdk/) ``` gcloud init ``` * Create an App Engine app within the current Google Cloud Project ``` gcloud app create ``` * In the `pom.xml`, update the [App Engine Maven Plugin](https://cloud.google.com/appengine/docs/standard/java/tools/maven-reference) with your Google Cloud Project Id: ``` com.google.cloud.tools appengine-maven-plugin 2.2.0 myProjectId GCLOUD_CONFIG ``` **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 vist: http://localhost:8080/ ### Deploying `mvn package appengine:deploy` To use vist: https://YOUR-PROJECT-ID.appspot.com ## Testing `mvn verify` As you add / modify the source code (`src/main/java/...`) it's very useful to add [unit testing](https://cloud.google.com/appengine/docs/java/tools/localunittesting) to (`src/main/test/...`). The following resources are quite useful: * [Junit4](http://junit.org/junit4/) * [Mockito](http://mockito.org/) * [Truth](http://google.github.io/truth/) For further information, consult the [Java App Engine](https://developers.google.com/appengine/docs/java/overview) documentation.