Specifying dependencies

You can use any Java compatible libraries with the Java runtime on theApp Engine flexible environment.These instructions use Apache Maven to build, run, and deploy a sample app usingasupported Javaruntime. For more information about using supported Java versions, see theJava runtime.

For details about installing Maven, seeUsing Apache Maven and the App Engine plugin.

Declare and manage dependencies

To manage dependencies using Maven, you need to specify the dependencies inthe<dependencies> section inside thepom.xmlfile of your project.

To manage your project's dependency on Maven itself, you can use theMaven Wrapper. If you do not use theMaven Wrapper, App Engine defaults to using a recent version of Mavenwhen runninggcloud app deploy.

Specify the Java servlet library

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

<dependency><groupId>com.example.appengine</groupId><artifactId>simple-jetty-main</artifactId><version>1</version><scope>provided</scope></dependency>
Note that frameworks such asSparkJava orSpring Boot won't require the servlet library.

Use the Cloud Client Libraries

Cloud Client Libraries for Javaprovide idiomatic access to Google Cloud services. To use a library, declareit as a dependency.

Typically, you only declare dependencies on the specific libraries that your appneeds. For example, to use the Cloud Storage library:

<!--Usinglibraries-bomtomanageversions.Seehttps://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM--><dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>libraries-bom</artifactId><version>26.28.0</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>google-cloud-storage</artifactId></dependency></dependencies>

You can configure the Cloud Client Libraries for Java tohandle authentication automatically.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.