Skip to content

Commit

Permalink
add war plugin (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesv authored and dpebot committed Dec 14, 2016
1 parent 4a697a9 commit b8d6110
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
10 changes: 7 additions & 3 deletions appengine/cloudsql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ Developers Console](https://console.developers.google.com/sql/instances). Altern

## Deploying

`$ mvn clean appengine:deploy -DINSTANCE_CONNECTION_NAME="instanceConnectionName" -Duser=root
-Dpassword=myPassword -Ddatabase=myDatabase`
```bash
$ mvn clean appengine:deploy -DINSTANCE_CONNECTION_NAME="instanceConnectionName" -Duser=root
-Dpassword=myPassword -Ddatabase=myDatabase
```

Or you can update the properties in `pom.xml` and

## Running locally
1. You will need to be running a local instance of MySQL.

`$ mvn clean appengine:run -Duser=root -Dpassword=myPassowrd -Ddatabase=myDatabase`
```bash
$ mvn clean appengine:run -Duser=root -Dpassword=myPassowrd -Ddatabase=myDatabase
```

22 changes: 16 additions & 6 deletions appengine/cloudsql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,23 @@
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/webapp/WEB-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<webResources>
<!-- in order to interpolate version from pom into appengine-web.xml -->
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
// Set the url with the local MySQL database connection url when running locally
url = System.getProperty("ae-cloudsql.local-database-url");
}
log("connecting to: " + url);
try (Connection conn = DriverManager.getConnection(url);
PreparedStatement statementCreateVisit = conn.prepareStatement(createVisitSql)) {
conn.createStatement().executeUpdate(createTableSql);
Expand Down

0 comments on commit b8d6110

Please sign in to comment.