From 29b7952da66118d8e696694b2061260c8feddd57 Mon Sep 17 00:00:00 2001 From: Les Vogel <lesv@google.com> Date: Mon, 9 Jan 2017 13:21:57 -0800 Subject: [PATCH] Use the Java SDK Plugin 1. We want to use the Java SDK plugin for now --- appengine/cloudsql/README.md | 12 +++++++++--- appengine/cloudsql/pom.xml | 12 ++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/appengine/cloudsql/README.md b/appengine/cloudsql/README.md index 1c01860847d..f2c6a3c623a 100644 --- a/appengine/cloudsql/README.md +++ b/appengine/cloudsql/README.md @@ -7,14 +7,20 @@ Before you can run or deploy the sample, you will need to create a [Cloud SQL in 1. Create a new user and database for the application. The easiest way to do this is via the [Google Developers Console](https://console.cloud.google.com/sql/instances). Alternatively, you can use MySQL tools such as the command line client or workbench. 2. Change the root password (under Access Control) and / or create a new user / password. -3. Create a Database (under Databases) (or use MySQL with `gcloud sql connect <instance> --user=root`) +3. Create a Database (under Databases) (or use MySQL with `gcloud beta sql connect <instance> --user=root`) 4. Note the **Instance connection name** under Overview > properties (It will look like project:instance for 1st Generation or project:region:zone for 2nd Generation) +or + +```bash +gcloud sql instances describe <instance> | grep connectionName +``` + ## Deploying ```bash -$ mvn clean appengine:deploy -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root +$ mvn clean appengine:update -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root -Dpassword=myPassword -Ddatabase=myDatabase ``` @@ -23,7 +29,7 @@ Or you can update the properties in `pom.xml` ## Running locally ```bash -$ mvn clean appengine:run -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root -Dpassword=myPassowrd -Ddatabase=myDatabase +$ mvn clean appengine:devserver -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root -Dpassword=myPassowrd -Ddatabase=myDatabase ``` Note - you must use a local mysql instance for the 1st Generation instance and change the local Url in `src/main/webapp/WEB-INF/appengine-web.xml` to use your local server. diff --git a/appengine/cloudsql/pom.xml b/appengine/cloudsql/pom.xml index 3eca56527ae..7ef9d29cdf7 100644 --- a/appengine/cloudsql/pom.xml +++ b/appengine/cloudsql/pom.xml @@ -58,8 +58,16 @@ <dependency> <groupId>com.google.appengine</groupId> <artifactId>appengine-api-1.0-sdk</artifactId> + <version>${appengine.sdk.version}</version> </dependency> + <dependency> + <groupId>com.google.api-client</groupId> + <artifactId>google-api-client-appengine</artifactId> + <version>1.21.0</version> + </dependency> + + <!-- [START dependencies] --> <dependency> <!-- ONLY USED LOCALY --> <groupId>mysql</groupId> @@ -93,18 +101,18 @@ </configuration> </plugin> +<!-- <plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>appengine-maven-plugin</artifactId> <version>${appengine.maven.plugin}</version> </plugin> -<!-- + --> <plugin> <groupId>com.google.appengine</groupId> <artifactId>appengine-maven-plugin</artifactId> <version>${appengine.sdk.version}</version> </plugin> - --> </plugins> </build> </project>