Using Java Libraries

You can use any Java compatible libraries with the App Engine flexible environment. In these instructions we require Apache Maven.

Declaring and managing dependencies

You manage the dependencies for Maven projects by specifying which libraries to include in the <dependencies> section inside the pom.xml file for the project.

Required plugin

The <plugins> section in the pom.xml file should include this plugin:

<plugin>
   <groupId>com.google.appengine</groupId>
   <artifactId>gcloud-maven-plugin</artifactId>
   <version>2.0.9.120.v20160803</version>
</plugin>

Specifying the Java servlet library

Most Java apps require the Java servlet library (Some Frameworks, like SparkJava or Spring Boot will not require this); as shown in this <dependencies> entry within pom.xml:

<dependencies>

  <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <type>jar</type>
    <scope>provided</scope>
  </dependency>

</dependencies>

Specifying the dependencies to use the Google Cloud Client Libraries for Java

You can use the Google Cloud Client Libraries for Java with the Java 8 and Jetty9 runtimes. You must add these lines to your pom.xml file:

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud</artifactId>
  <version>0.3.0</version>
</dependency>

You can verify the current version number by checking the sample snippet at the top of the google-cloud library web page.

Specifying dependencies to use Cloud Storage

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-storage</artifactId>
  <version>0.6.0</version>
</dependency>

Specifying dependencies to use memcache

<dependency>
  <groupId>com.googlecode.xmemcached</groupId>
  <artifactId>xmemcached</artifactId>
  <version>2.2.0</version>
</dependency>

Send feedback about...

App Engine flexible environment for Java docs