gcloud app deploy コマンドなどの Google Cloud SDK ベースのツールや、IntelliJ、Eclipse、Maven、Gradle の各プラグインを使用してアプリをデプロイする場合には、必須ではありません。Google Cloud SDK ベースのツールは、この要素を無視し、gcloud 構成プロジェクトのプロパティからプロジェクト ID を取得します。gcloud コマンドライン ツールでプロジェクト ID をオーバーライドできますが、これはマシンワイドのプロジェクト ID であり、複数のプロジェクトを開発している場合、混乱が起きる可能性があるので注意してください。<application> 要素にはアプリケーションのプロジェクト ID が格納されます。これは、 Google Cloud consoleでプロジェクトを作成するときに登録するプロジェクト ID です。
JAR ファイルのアセンブルや、JSP のコンパイルなど、デプロイ中に行われる作業の多くは、ステージングと呼ばれる準備段階でローカルに実行されます。アプリケーション構成ファイル内のステージング要素を使用して、ステージング動作の特定の部分を構成することもできます。ほとんどのアプリケーションは、ステージング動作を手動で構成しなくてもデプロイできます。お使いのアプリがデプロイできない場合は、以下のオプションを使用してステージングを構成する必要があります。
要素
説明
<staging>
省略可。ほとんどのアプリケーションでは、デフォルト動作を変更する必要がありません。
ステージング要素により、デプロイに必要な特定のステージング構成を指定できます。
この要素には次の要素を設定できます。
<enable-jar-splitting>
省略可。10 メガバイトを超える大きい jar ファイルを小さいフラグメントに分割します(デフォルトは true です)。
<jar-splitting-excludes>
ファイル接尾辞のカンマ区切りのリストを指定します。enable-jar-splitting を有効にすると、接尾辞に一致するすべてのファイルがすべての JAR から除外されます。
[[["わかりやすい","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 UTC。"],[[["\u003cp\u003eThe \u003ccode\u003eappengine-web.xml\u003c/code\u003e file, located in the \u003ccode\u003eWEB-INF/\u003c/code\u003e directory of a WAR file, is essential for configuring App Engine Java applications, including settings for static files, resource files, and non-default services.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eappengine-web.xml\u003c/code\u003e includes elements like \u003ccode\u003e<application>\u003c/code\u003e (project ID), \u003ccode\u003e<app-engine-apis>\u003c/code\u003e (legacy services), \u003ccode\u003e<entrypoint>\u003c/code\u003e (custom entry point), and numerous others, to manage various aspects of application behavior such as scaling, environment variables, and session management.\u003c/p\u003e\n"],["\u003cp\u003eScaling configurations in \u003ccode\u003eappengine-web.xml\u003c/code\u003e are defined through elements like \u003ccode\u003e<automatic-scaling>\u003c/code\u003e, \u003ccode\u003e<basic-scaling>\u003c/code\u003e, and \u003ccode\u003e<manual-scaling>\u003c/code\u003e, each allowing control over instance management, CPU utilization, request handling, and idle behavior.\u003c/p\u003e\n"],["\u003cp\u003eStaging elements within \u003ccode\u003eappengine-web.xml\u003c/code\u003e enable customization of the deployment preparation process, including splitting large JAR files, handling JSP compilation, and managing the inclusion or exclusion of specific files, with different defaults depending on whether the App Engine SDK or Google Cloud SDK is used.\u003c/p\u003e\n"],["\u003cp\u003eStatic files are managed with \u003ccode\u003e<static-files>\u003c/code\u003e and \u003ccode\u003e<resource-files>\u003c/code\u003e, through include and exclude rules using \u003ccode\u003e*\u003c/code\u003e and \u003ccode\u003e**\u003c/code\u003e wildcards, and mime-types that can be defined in \u003ccode\u003eweb.xml\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# appengine-web.xml reference\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/standard/python/how-requests-are-routed#region-id). \nOK\n| **Note:** If you use legacy bundled services and want to upgrade to Java 21, you can choose to continue using `javax.servlet.*` APIs only if your apps run on Java Enterprise Edition 8 (EE8). You must update your `appengine-web.xml` file if you choose to remain on EE8. To learn more about your configuration options, see [Upgrade an existing application](/appengine/docs/standard/java-gen2/upgrade-java-runtime).\n\nYou should use the `appengine-web.xml` file for configuring your app only\nif you are migrating an existing app from the App Engine Java 8 runtime to the\nlatest supported Java version and you want to [use the legacy bundled services](/appengine/docs/standard/java-gen2/services/access).\nIf you are using an `appengine-web.xml` in your project, the `app.yaml` is\nautomatically generated for you at deployment.\n\nApp Engine Java applications use a configuration file, named `appengine-web.xml`,\nto specify information about your app and to identify which files in the app's\n`WAR` file are static files (like images) and which are resource files used by\nthe application.\n\nSyntax\n------\n\nAn App Engine Java app must have a file named `appengine-web.xml` in its\nWAR, in the directory `WEB-INF/`. This is an XML file whose root element is\n`\u003cappengine-web-app\u003e`.\n\nYou can find the Document Type Definition and schema specifications for the\n`appengine-web.xml` in the SDK's `docs/` directory.\n| **Note:** The standard `appengine-web.xml` file defines the default service. You will need to specify additional configuration parameters for each non-default service, which were formerly known as modules. These are described in the [overview of\n| App Engine](/appengine/docs/standard). You can also apply these configuration parameters to the default service.\n\n### Scaling elements\n\nThe following table lists the options for defining how you can specify that your\napplication should scale.\n\nFor a comparison of the performance features of the scaling types, see\n[Scaling dynamic instances](/appengine/docs/standard/how-instances-are-managed#scaling_dynamic_instances).\n\n### Staging elements\n\nMuch of the work done during a deployment occurs locally in a preparation step\ncalled *staging*, where JAR files are assembled, JSPs are compiled, and so forth.\nYou can optionally configure certain parts of the staging\nbehavior using staging elements in the application configuration file. Most\napplications will deploy successfully without manually configuring staging\nbehavior. If your app doesn't deploy, you may need to configure staging\nusing the options shown below.\n\n### Staging option defaults\n\nThe defaults for staging options are different depending on whether you use\nGoogle Cloud SDK-based tooling, such as the gcloud CLI, or the\nGoogle Cloud SDK-based\n[Maven](/appengine/docs/standard/java-gen2/using-maven),\n[Gradle](/appengine/docs/standard/java-gen2/using-gradle),\n[Eclipse](/eclipse/docs), or [IntelliJ](/tools/intellij/docs) plugins.\n\n### Include and exclude syntax\n\nPath patterns are specified using zero or more `\u003cinclude\u003e` and\n`\u003cexclude\u003e` elements. In a pattern, `'*'` represents zero or more\nof any character in a file or directory name, and `**` represents zero or more\ndirectories in a path. Files and directories matching `\u003cexclude\u003e`\npatterns will not be uploaded when you deploy your app to App Engine. However,\nthese files and directories will still be accessible to your application when\nrunning on the local Development Server.\n\nAn `\u003cinclude\u003e` element overrides the default behavior of including\nall files. An `\u003cexclude\u003e` element applies after all\n`\u003cinclude\u003e` patterns (as well as the default if no explicit\n`\u003cinclude\u003e` is provided).\n\nThe following example demonstrates how to designate all `.png` files as static\nfiles (except those in the `data/` directory and all of its subdirectories): \n\n \u003cstatic-files\u003e\n \u003cinclude path=\"/**.png\" /\u003e\n \u003cexclude path=\"/data/**.png\" /\u003e\n \u003c/static-files\u003e\n\nYou can also set HTTP headers to use when responding to requests to these static\nresources. \n\n \u003cstatic-files\u003e\n \u003cinclude path=\"/my_static-files\" \u003e\n \u003chttp-header name=\"Access-Control-Allow-Origin\"\n value=\"http://example.org\" /\u003e\n \u003c/include\u003e\n \u003c/static-files\u003e\n\n| **Note:** If the `path` string doesn't start with a slash, then the HTTP headers, if any, work on App Engine but do **not** work on the Development Server.\n\nMIME types for static files\n---------------------------\n\nBy default, static files are served using a MIME type selected based on the\nfilename extension. You can associate custom MIME types with filename\nextensions for static files using `mime-mapping` elements in `web.xml`.\n\nURLFetch timeout\n----------------\n\nYou can set a deadline for each\n[URLFetch](/appengine/docs/standard/services/urlfetch/issue-requests#setting_a_request_timeout) request. By default, the deadline for a fetch is 5 seconds.\nYou can change this default by including the following setting in your\n`appengine-web.xml` configuration file. Specify the timeout in seconds: \n\n \u003csystem-properties\u003e\n \u003cproperty name=\"appengine.api.urlfetch.defaultDeadline\" value=\"10\"/\u003e\n \u003c/system-properties\u003e"]]