Using Java Libraries

You can use any Java compatible libraries with the Java runtime on the App Engine flexible environment. These instructions use Apache Maven to build, run, and deploy the sample app. For details about installing Maven, see Using Apache Maven and the App Engine Plugin.

Declaring and managing dependencies

To manage dependencies using Maven, you need to specifying the dependencies in the <dependencies> section inside the pom.xml file of your project.

Specifying the Java servlet library

Eclipse, Jetty, and Tomcat apps require the Java servlet library. Specify it in your pom.xml file's <dependencies> entry:

<dependencies>

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

</dependencies>

Note that frameworks such as SparkJava or Spring Boot will not require the servlet library.

Using the Google Cloud Client Libraries for Java

You can use the Google Cloud Client Libraries for Java by adding these lines to your pom.xml file:

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

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

Importing specific libraries

You can also import specific libraries, such as the Cloud Storage library:

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-storage</artifactId>
  <version>1.100.0</version>
</dependency>
Was this page helpful? Let us know how we did:

Send feedback about...

App Engine flexible environment for Java docs