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 a sample app using
Java runtime version 8 and version 11/17. Note that you must update your app.yaml
to use the new version. See Java runtime for more information
about using the new runtimes.
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 specify the dependencies in
the <dependencies>
section inside the
pom.xml
file of your project.
To manage your project's dependency on Maven itself, you can use the
Maven Wrapper. If you do not use the
Maven Wrapper, App Engine defaults to using a recent version of Maven
when running gcloud app deploy
.
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:
version 11/17
version 8
Using the Cloud Client Libraries
Cloud Client Libraries for Java provide idiomatic access to Google Cloud services. To use a library, declare it as a dependency.
Typically, you only declare dependencies on the specific libraries that your app needs. For example, to use the Cloud Storage library:
You can configure the Cloud Client Libraries for Java to handle authentication automatically.