Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Sie können alle Java-kompatiblen Bibliotheken mit der Java-Laufzeit in der flexiblen App Engine-Umgebung verwenden.
In dieser Anleitung wird Apache Maven zum Erstellen, Ausführen und Bereitstellen einer Beispielanwendung mit einer unterstützten Java-Laufzeit verwendet. Weitere Informationen zur Verwendung unterstützter Java-Versionen finden Sie unter Java-Laufzeit.
Wenn Sie Abhängigkeiten mit Maven verwalten möchten, müssen Sie die Abhängigkeiten im Abschnitt <dependencies> in der Datei pom.xml Ihres Projekts angeben.
Sie können den Maven-Wrapper verwenden, um die Abhängigkeit Ihres Projekts von Maven selbst zu verwalten. Wenn Sie den Maven-Wrapper nicht verwenden, verwendet App Engine standardmäßig eine aktuelle Version von Maven, wenn Sie gcloud app deploy ausführen.
Java-Servlet-Bibliothek angeben
Für Eclipse-, Jetty- und Tomcat-Anwendungen ist die Java-Servlet-Bibliothek erforderlich. Geben Sie sie im Eintrag <dependencies> Ihrer pom.xml-Datei an:
Beachten Sie, dass Frameworks wie SparkJava oder Spring Boot die Servlet-Bibliothek nicht benötigen.
Cloud-Clientbibliotheken verwenden
Google Cloud-Clientbibliotheken für Java bieten idiomatischen Zugriff auf Google Cloud-Dienste. Wenn Sie eine Bibliothek verwenden möchten, müssen Sie sie als Abhängigkeit deklarieren.
In der Regel deklarieren Sie nur Abhängigkeiten für die jeweiligen Bibliotheken, die Ihre Anwendung benötigt. So verwenden Sie beispielsweise die Cloud Storage-Bibliothek:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThe App Engine flexible environment allows the use of any Java-compatible libraries with the Java runtime.\u003c/p\u003e\n"],["\u003cp\u003eApache Maven is used to build, run, and deploy apps using a supported Java runtime, and it is also used to manage dependencies in the \u003ccode\u003epom.xml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eJava servlet library is required for Eclipse Jetty and Tomcat apps and must be specified in the \u003ccode\u003epom.xml\u003c/code\u003e file, but frameworks like SparkJava or Spring Boot do not need this.\u003c/p\u003e\n"],["\u003cp\u003eCloud Client Libraries for Java provide access to Google Cloud services, and their dependencies are declared in the \u003ccode\u003epom.xml\u003c/code\u003e file, typically only for the libraries your app uses.\u003c/p\u003e\n"]]],[],null,["# Specifying dependencies\n\nYou can use any Java compatible libraries with the Java runtime on the\nApp Engine flexible environment.\n\nThese instructions use Apache Maven to build, run, and deploy a sample app using\na [supported](/appengine/docs/flexible/lifecycle/support-schedule#java) Java\nruntime. For more information about using supported Java versions, see the\n[Java runtime](/appengine/docs/flexible/java/runtime).\nFor details about installing Maven, see [Using Apache Maven and the App Engine plugin](/appengine/docs/flexible/java/using-maven).\n\n\u003cbr /\u003e\n\nDeclare and manage dependencies\n-------------------------------\n\nTo manage dependencies using Maven, you need to specify the dependencies in\nthe `\u003cdependencies\u003e` section inside the\n[`pom.xml`](http://maven.apache.org/guides/introduction/introduction-to-the-pom.html)\nfile of your project.\n\nTo manage your project's dependency on Maven itself, you can use the\n[Maven Wrapper](https://maven.apache.org/wrapper/). If you do not use the\nMaven Wrapper, App Engine defaults to using a recent version of Maven\nwhen running [`gcloud app deploy`](/sdk/gcloud/reference/app/deploy).\n\nSpecify the Java servlet library\n--------------------------------\n\nEclipse Jetty and Tomcat apps require the Java servlet library. Specify it in\nyour `pom.xml` file's `\u003cdependencies\u003e` entry:\n\n\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.example.appengine\u003c/groupId\u003e\n \u003cartifactId\u003esimple-jetty-main\u003c/artifactId\u003e\n \u003cversion\u003e1\u003c/version\u003e\n \u003cscope\u003eprovided\u003c/scope\u003e\n \u003c/dependency\u003e\n\nNote that frameworks such as [SparkJava](http://sparkjava.com/) or [Spring Boot](http://projects.spring.io/spring-boot/) won't require the servlet library.\n\n\u003cbr /\u003e\n\nUse the Cloud Client Libraries\n------------------------------\n\n[Cloud Client Libraries for Java](https://github.com/googleapis/google-cloud-java)\nprovide idiomatic access to Google Cloud services. To use a library, declare\nit as a dependency.\n\nTypically, you only declare dependencies on the specific libraries that your app\nneeds. For example, to use the Cloud Storage library:\n\n\n \u003c!-- Using libraries-bom to manage versions.\n See https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM --\u003e\n \u003cdependencyManagement\u003e\n \u003cdependencies\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.cloud\u003c/groupId\u003e\n \u003cartifactId\u003elibraries-bom\u003c/artifactId\u003e\n \u003cversion\u003e26.28.0\u003c/version\u003e\n \u003ctype\u003epom\u003c/type\u003e\n \u003cscope\u003eimport\u003c/scope\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n \u003c/dependencyManagement\u003e\n\n \u003cdependencies\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.cloud\u003c/groupId\u003e\n \u003cartifactId\u003egoogle-cloud-storage\u003c/artifactId\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n\nYou can configure the Cloud Client Libraries for Java to\n[handle authentication automatically](/docs/authentication/client-libraries)."]]