Java 8 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Java 8 アプリケーションをデプロイできなくなります。既存の Java 8 アプリケーションは、
非推奨になる日付以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Java に移行することをおすすめします。
gcloud CLI ベースの Gradle プラグインへの移行
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
以前に Java App Engine SDK ベースのプラグイン(com.google.appengine.appengine-gradle
)を使用したことがあり、新しい Google Cloud CLI に移行する場合は、gcloud CLI ベース(com.google.cloud.tools.appengine-gradle
)のプラグインに移行します。
gcloud CLI ベースのプラグインのメリット
新しいプラグインにアップグレードすると、次のような利点があります。
他のすべての gcloud CLI ベースのコマンドと同じ、標準の gcloud auth login
フローから生成される認証情報が使用されます。
App Engine フレキシブル環境がサポートされます。
標準の gcloud CLI 更新フローの一環として、ローカル開発用サーバーが自動的に更新されます。
App Engine サービス(cron、queue、dos、dispatch)構成を、ご使用のサービスとは独立してデプロイできます。
大きな相違点
移行を行う前に、次の大きな相違点に注意してください。
- gcloud CLI の依存関係
- 古いプラグインは、Java を除き、特定のローカル環境に依存せずに実行されますが、新しいプラグインでは gcloud CLI をインストールする必要があります。
- Endpoints のディスカバリ ドキュメントが生成されない
- 新しいプラグインでは、Endpoints のディスカバリ ドキュメントが生成されません。この機能は別のプラグインで提供されます。Endpoints をバックエンドで実行する際、ビルドステップでこのファイルを生成する必要はなくなりました。このファイルは、ランタイムにサーバーによって生成されます。新しいプラグインは、iOS や Android などのクライアント ライブラリを生成する必要がある場合にのみ使用する必要があります。新しいプラグインの詳細については、App Engine 用 Endpoints Frameworks への移行をご覧ください。
- EAR ファイル形式のサポート終了
- 新しいプラグインでは、複数のサービスを同時に実行およびデプロイするための EAR ファイル形式がサポートされなくなりました。
- 新しいデプロイ コマンド
- 古いプラグインでは、アプリケーションをデプロイするために
appcfg
コマンドを呼び出しますが、新しいプラグインでは、新しい gcloud CLI を使用してデプロイします。 - JPA/JDO Datanucleus エンハンスメントの手動構成が必要
- プロジェクトで
gradle-appengine-plugin
の JPA / JDO Datanucleus エンハンスメントを使用している場合は、gcloud CLI ベースのプラグインに切り替えた後に Datanucleus エンハンスメントを手動で構成する必要があります。Stack Overflow の例をご覧ください。 - Android Studio が未サポート
- Android Studio プロジェクトで新しいプラグインを使用するように切り替えることは可能ですが、Android Studio App Engine 開発用サーバーおよびデプロイは新しいプラグインではサポートされていません。アプリを実行してデプロイするには、Gradle を直接呼び出す必要があります。
XML 構成ファイルの使用はサポートされていますが、YAML 形式はサポートされていません。
新しいプラグインに移行する
古い gradle-appengine-plugin
構成とインポートを build.gradle
ファイルから削除します。
build.gradle
ファイルの buildscript
セクションの classpath
に新しいプラグインを追加します。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.0.1'
}
}
サービスのルートで、次のコマンドを実行して、アプリをローカルに実行できるかどうかを確認します。
gradle appengineRun
build.gradle
ファイルの buildscript
セクションで、プロジェクト ID とバージョンを指定してデプロイを構成します。
appengine {
deploy {
version = 'v1'
project = "your GCP project ID"
}
}
新しいツールでは、appengine-web.xml
ファイル内のアプリケーション要素とバージョン要素は無視されます。
サービスのルートで、次のコマンドを実行して、アプリケーションをデプロイできるかどうかを確認します。
gradle appengineDeploy
EAR ベースの複数サービス構成を移行する
新しいプラグインは EAR パッケージに対応していません。代わりに、特別なパッケージング手順を踏まなくても、複数のサービスをローカルで実行できるようになっています。
EAR ベースの Gradle プロジェクトを移行するには:
プライマリ サービスを選択して、そのサービスによって残りのサービスが実行されるようにします。デフォルト サービスを選択する必要がありますが、一緒に実行されるサービスであればどのサービスを選択してもかまいません。
appengine
構成で、run.services
エントリを変更して、ローカル開発用サーバーで実行する必要があるすべてのサービスを追加します。
プロジェクト構造の例:
../{projectRoot}/
build.gradle
settings.gradle (includes default-service & secondary-service)
{your-default-service}/build.gradle {includes appengine-gradle-plugin}
….
{your-default-service}/src/main/webapp/WEB-INF/appengine-web.xml
{your-secondary-service}build.gradle {includes appengine-gradle-plugin}
….
{your-secondary-service}/src/main/webapp/WEB-INF/appengine-web.xml
build.gradle
buildscript の例:
appengine {
run {
// configure the app to point to the right service directories
services = [
projectAsService(project),
projectAsService(":another-module")
]
}
}
// helper method to obtain correct directory and set up dependencies
def getExplodedAppDir(Project serverProject) {
// if not 'this' module, then do some setup.
if (serverProject != project) {
// make sure we evaluate other modules first so we get the right value
evaluationDependsOn(serverProject.path)
// make sure we build "run" depends on the other modules exploding wars
project.tasks.appengineRun.dependsOn serverProject.tasks.explodeWar
}
return serverProject.tasks.explodeWar.explodedAppDirectory
}
App Engine SDK ベースと gcloud CLI ベースの Gradle コマンドの相違
App Engine SDK ベースの Gradle プラグインと gcloud CLI ベースの Gradle プラグインのどちらを使用するかに応じて Maven プラグインの呼び出し方法が異なります。次の表に、その違いを示します。
次のステップ
- 新しいプラグインへの移行が正常に終了したので、次にアプリケーションをテストしてデプロイします。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","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\u003eMigrate from the Java App Engine SDK-based plugin (\u003ccode\u003ecom.google.appengine.appengine-gradle\u003c/code\u003e) to the gcloud CLI-based plugin (\u003ccode\u003ecom.google.cloud.tools.appengine-gradle\u003c/code\u003e) for enhanced benefits, including unified authentication, flexible environment support, and automatic updates.\u003c/p\u003e\n"],["\u003cp\u003eThe new gcloud CLI-based plugin requires the gcloud CLI to be installed and no longer supports Endpoints discovery doc generation within the plugin, as it's now handled at runtime, nor does it support the EAR file format for multiple services.\u003c/p\u003e\n"],["\u003cp\u003eManual configuration of Datanucleus enhancement is necessary if your project uses JPA/JDO, and Android Studio's built-in App Engine support is incompatible, requiring direct Gradle invocation.\u003c/p\u003e\n"],["\u003cp\u003eMigrating from EAR-based multi-service configurations to the new plugin involves selecting a primary service and configuring the \u003ccode\u003erun.services\u003c/code\u003e entry in your \u003ccode\u003ebuild.gradle\u003c/code\u003e to include all services for local development, replacing EAR packaging entirely.\u003c/p\u003e\n"],["\u003cp\u003eThe gcloud CLI-based plugin uses new Gradle commands like \u003ccode\u003eappengineRun\u003c/code\u003e for local development and \u003ccode\u003eappengineDeploy\u003c/code\u003e for deployment, replacing the old SDK-based commands such as \u003ccode\u003eappengine:devserver\u003c/code\u003e and \u003ccode\u003eappengine:update\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Migrating to the gcloud CLI-based Gradle plugin\n\nIf you previously used the Java App Engine SDK-based plugin\n(`com.google.appengine.appengine-gradle`) and want to move to the new\n[Google Cloud CLI](/sdk/downloads), migrate to the gcloud CLI-based\n(`com.google.cloud.tools.appengine-gradle`) plugin.\n\nBenefits of the gcloud CLI-based plugin\n---------------------------------------\n\nUpgrading to the new plugin provides the following benefits:\n\n- Uses the same authentication credentials as all other gcloud CLI\n -based commands, which are produced from the standard `gcloud auth login`\n flow.\n\n- Supports the App Engine flexible environment.\n\n- Updates the local development server automatically as part of the standard\n gcloud CLI update flow.\n\n- Supports deploying App Engine service (cron, queues, dos, dispatch)\n configurations, independently from your service.\n\nNotable differences\n-------------------\n\nBefore you migrate, be aware of these notable differences:\n\ngcloud CLI dependency\n: The old plugin runs without any specific local environment dependencies,\n besides Java, but the new plugin requires that you have the\n gcloud CLI installed.\n\nNo Endpoints discovery doc generation\n: The new plugin does not generate Endpoints discovery docs, a\n feature available in a separate plugin. Running your Endpoints\n backend no longer requires generating this file in a build step as the server\n now generates it at runtime. You should use the new plugin only if you need\n to generate client libraries such as for iOS or Android. Learn more about the\n new plugins by reviewing the [Migrating to Endpoints Frameworks for\n App Engine](/endpoints/docs/frameworks/legacy/v1/java/migrating)\n guide.\n\nEAR file format no longer supported\n: The new plugin no longer supports the\n EAR file format for running and deploying multiple services at the same time.\n\nNew deployment command\n: The old plugin calls the `appcfg` command to deploy\n applications, while the new plugin deploys using the new gcloud CLI.\n\nJPA/JDO Datanucleus enhancement must be manually configured\n: If your project\n uses the `gradle-appengine-plugin`'s JPA/JDO Datanucleus enhancement, you must\n manually configure Datanucleus enhancement after switching to the\n gcloud CLI-based plugin. See an [example from Stackoverflow](https://stackoverflow.com/questions/29279503/how-can-i-run-datanucleus-enhancer-from-gradle).\n\nAndroid Studio is not supported\n: You can switch your Android Studio project to use the new plugin, but the\n Android Studio App Engine development server and deployment support\n does not work with this new plugin. To run and deploy your app, you have to\n invoke Gradle directly.\n\nUse of XML configuration files is supported, but not YAML.\n\nMigrating to the new plugin\n---------------------------\n\n1. Remove the old `gradle-appengine-plugin` configuration and imports from your\n `build.gradle` file.\n\n2. Add the new plugin to the `classpath` of your `build.gradle` file's\n `buildscript` section:\n\n buildscript {\n repositories {\n mavenCentral()\n }\n\n dependencies {\n classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.0.1'\n }\n }\n\n3. At the root of your service, run the following command to verify that you can\n run your app locally:\n\n gradle appengineRun\n\n4. In your `build.gradle` file's `buildscript` section, configure your\n deployment by specifying your project ID and version:\n\n appengine {\n deploy {\n version = 'v1'\n project = \"your GCP project ID\"\n }\n }\n\n The new tooling ignores the application and version elements in your\n `appengine-web.xml` file.\n5. At the root of your service, run the following command to verify that you can\n deploy your application:\n\n gradle appengineDeploy\n\nMigrating EAR based multi-service configurations\n------------------------------------------------\n\nThe new plugin does not support EAR packaging. Instead, it supports running\nmultiple services locally without any special packaging steps.\n\nTo migrate your EAR-based Gradle project:\n\n1. Pick a primary service that will be responsible for running the rest of the\n services. You should select your default service, but it can be any of the\n services that are run together.\n\n2. In your `appengine` configuration, modify the `run.services` entry to include\n all the services that should be run by the local development server.\n\n An example project structure: \n\n ../{projectRoot}/\n build.gradle\n settings.gradle (includes default-service & secondary-service)\n {your-default-service}/build.gradle {includes appengine-gradle-plugin}\n ....\n {your-default-service}/src/main/webapp/WEB-INF/appengine-web.xml\n {your-secondary-service}build.gradle {includes appengine-gradle-plugin}\n ....\n {your-secondary-service}/src/main/webapp/WEB-INF/appengine-web.xml\n\n An example `build.gradle` buildscript: \n\n appengine {\n run {\n // configure the app to point to the right service directories\n services = [\n projectAsService(project),\n projectAsService(\":another-module\")\n ]\n }\n }\n\n // helper method to obtain correct directory and set up dependencies\n def getExplodedAppDir(Project serverProject) {\n // if not 'this' module, then do some setup.\n if (serverProject != project) {\n // make sure we evaluate other modules first so we get the right value\n evaluationDependsOn(serverProject.path)\n // make sure we build \"run\" depends on the other modules exploding wars\n project.tasks.appengineRun.dependsOn serverProject.tasks.explodeWar\n }\n return serverProject.tasks.explodeWar.explodedAppDirectory\n }\n\nApp Engine SDK-based vs gcloud CLI-based Gradle commands\n--------------------------------------------------------\n\nThe following table shows the different ways you invoke the Gradle plugin,\ndepending on whether you use the App Engine SDK-based Gradle plugin or\nthe [gcloud CLI-based Gradle](/appengine/docs/legacy/standard/java/using-gradle)\nplugin.\n\nWhat's next\n-----------\n\n- Now that you have migrated to the new plugin successfully, you can [test](/appengine/docs/legacy/standard/java/using-gradle#testing_gradle_app) and [deploy](/appengine/docs/legacy/standard/java/using-gradle#deploying_gradle_app) your application."]]