[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\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)."]]