Premiers pas : Configurer votre environnement de développement
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Découvrez comment configurer votre environnement de compilation pour développer et déployer des applications dans l'environnement d'exécution Java 8 au sein de l'environnement standard App Engine.
Installer et configurer le plug-in App Engine pour Maven.
App Engine dispose également de plug-ins pour Gradle, IntelliJ IDEA et Eclipse, mais ce guide se concentre sur le plug-in pour Maven.
créer un projet App Engine.
accorder à Cloud Build l'autorisation de compiler et de déployer votre application.
Définissez l'option -Dappengine-version sur la version la plus récente du SDK App Engine pour Java, et l'option application-id sur l'ID de votre projet Google Cloud.
Définissez l'option -Djava8=true pour déployer le projet dans l'environnement d'exécution Java 8.
Définissez l'option -DCloudSDK_Tooling=true pour utiliser les outils de gcloud CLI.
Lorsque vous êtes invité à choisir un archétype, choisissez la valeur 2 pour l'archétype du squelette App Engine. Cela crée un projet vide contenant la structure de répertoire et les fichiers requis.
Lorsque vous êtes invité à indiquer la version, appuyez sur ENTER pour sélectionner la version la plus récente par défaut.
Lorsque l'invite Define value for property 'groupId' s'affiche, indiquez l'espace de noms souhaité pour l'application. Par exemple : com.mycompany.myapp.
Lorsque l'invite Define value for property 'artifactId' s'affiche, indiquez le nom du projet. Par exemple : myapp.
Lorsque l'invite Define value for property 'version' s'affiche, acceptez la valeur par défaut.
Lorsque l'invite Define value for property 'package' s'affiche, indiquez le nom du package souhaité (ou acceptez le nom par défaut). Les fichiers Java générés portent le nom du package que vous spécifiez ici.
Lorsque vous êtes invité à confirmer vos choix, acceptez la valeur par défaut (Y).
Attendez la fin de la génération du projet, puis remplacez les répertoires par le nouveau répertoire du projet, par exemple myapp/.
Ajoutez le plug-in basé sur la CLI gcloud au fichier pom.xml de votre projet.
Spécifiez l'ID du projet Google Cloud Platform cible, ainsi que le service et la version dans la configuration du plug-in.
Accorder une autorisation à Cloud Build
Lorsque vous déployez votre application, App Engine utilise Cloud Build pour créer l'application dans un conteneur et déployer ce conteneur dans l'environnement d'exécution. Par défaut, Cloud Build n'est pas autorisé à déployer des applications Java 8. Vous devez donc accorder à Cloud Build l'autorisation de déployer des applications dans votre projet. Les compilations sont créées dans la région de l'application.
Étape suivante
Une fois l'environnement de développement configuré, vous pouvez commencer à développer et déployer des applications Java sur App Engine.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/04/21 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/04/21 (UTC)."],[[["\u003cp\u003eThis guide details how to set up a development environment for deploying Java 8 applications to the App Engine standard environment using Maven.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves installing the Java SE 8 SDK, the gcloud CLI, and the App Engine Java component, as well as configuring Maven.\u003c/p\u003e\n"],["\u003cp\u003eCreating a new App Engine project is achieved through Maven archetypes, where you'll set the application ID, choose the correct archetype, and define properties like group ID and project name.\u003c/p\u003e\n"],["\u003cp\u003eYou must also add the gcloud CLI-based plugin to the project's \u003ccode\u003epom.xml\u003c/code\u003e file and then configure it with your Google Cloud Platform project ID.\u003c/p\u003e\n"],["\u003cp\u003eCloud Build needs to be granted permission to deploy apps in order to successfully build and deploy Java 8 apps to App Engine.\u003c/p\u003e\n"]]],[],null,["# Getting Started: Setting Up Your Development Environment\n\nLearn how to set up your build environment for app development and deployment\nto the Java 8 runtime in the App Engine standard environment.\n\nThis guide will show you how to:\n\n- Install the [Google Cloud CLI](/sdk/docs/install).\n- Install and configure the App Engine plugin for Maven. App Engine also provides plugins for [Gradle](/appengine/docs/legacy/standard/java/using-gradle), [IntelliJ IDEA](/code/docs/intellij/create-standard), and [Eclipse](/eclipse/docs), but this guide demonstrates the Maven plugin.\n- Create a new App Engine project.\n- Give permission to Cloud Build to enable building and deploying your app.\n\nInstalling required SDKs\n------------------------\n\n1. If you haven't already installed Java SE 8 SDK,\n [install the Java SE 8 Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html).\n\n2. Install and initialize the latest version of the gcloud CLI.\n\n [Install and Initialize gcloud CLI](/sdk/docs)\n3. Install the App Engine Java component:\n\n gcloud components install app-engine-java\n\n4. Authorize your user account:\n\n gcloud auth application-default login\n\nConfiguring Maven in your development environment\n-------------------------------------------------\n\n1. [Download](http://maven.apache.org/download.cgi)\n Maven 3.5 or later from the Maven website.\n\n2. [Install](http://maven.apache.org/install.html)\n Maven 3.5 or later on your local machine.\n\n | **Note:** Linux users may need to download Maven instead of using `apt-get install` to install Maven.\n\nCreating a new App Engine project\n---------------------------------\n\nTo create an App Engine App:\n\n1. Create a new directory.\n\n2. Initialize the new project in the created directory:\n\n mvn archetype:generate -Dappengine-version=1.9.59 -Djava8=true -DCloudSDK_Tooling=true -Dapplication-id=your-app-id -Dfilter=com.google.appengine.archetypes:\n\n 1. Set `-Dappengine-version` to the most recent version of the App\n Engine SDK for Java, and `application-id` to the ID of your\n Google Cloud project.\n\n 2. Set `-Djava8=true` to deploy the project in the Java 8 runtime.\n\n 3. Set `-DCloudSDK_Tooling=true` to use gcloud CLI tooling.\n\n3. When prompted to choose an archetype, choose the value `2` for the\n App Engine skeleton archetype. This creates an empty project that contains\n the required directory structure and files.\n\n4. When prompted for version, press \u003ckbd\u003eENTER\u003c/kbd\u003e to select the default\n most recent version.\n\n5. When prompted to `Define value for property 'groupId'`, supply the desired namespace\n for your app; for example, `com.mycompany.myapp`.\n\n6. When prompted to `Define value for property 'artifactId'`, supply the project\n name; for example, `myapp`.\n\n7. When prompted to `Define value for property 'version'`, accept the default\n value.\n\n8. When prompted to `Define value for property 'package'`, supply your\n preferred package name (or accept the default). The generated Java files will\n have the package name you specify here.\n\n9. When prompted to confirm your choices, accept the default value (`Y`).\n\n10. Wait for the project to finish generating, then change directories to the\n new project directory, for example `myapp/`.\n\n11. Add the gcloud CLI-based plugin to your project's `pom.xml` file.\n\n \u003cbuild\u003e\n \u003cplugins\u003e\n [...]\n \u003cplugin\u003e\n \u003cgroupId\u003ecom.google.cloud.tools\u003c/groupId\u003e\n \u003cartifactId\u003eappengine-maven-plugin\u003c/artifactId\u003e\n \u003cversion\u003e2.4.4\u003c/version\u003e\n \u003cconfiguration\u003e\n \u003cprojectId\u003eyour-project-ID-goes-here\u003c/projectId\u003e\n \u003cversion\u003e1\u003c/version\u003e\n \u003c/configuration\u003e\n \u003c/plugin\u003e\n [...]\n \u003c/plugins\u003e\n \u003c/build\u003e\n\n12. Specify the target Google Cloud Platform project ID and the [service and\n version](/appengine/docs/legacy/standard/java/an-overview-of-app-engine#versions_and_instances)\n in the plugin configuration.\n\nGive permission to Cloud Build\n------------------------------\n\nWhen you deploy your app, App Engine uses Cloud Build to build the\napp into a container and deploy the container to the runtime. Cloud Build\ndoes not have permission to deploy Java 8 apps by default, so you need to\n[give Cloud Build permission to\ndeploy apps](/build/docs/securing-builds/set-service-account-permissions#granting_additional_access)\nin your project. The builds are created in the app's region.\n\nWhat's next\n-----------\n\nNow that your development environment is set up, you can get started\ndeveloping and deploying Java apps to App Engine.\n\n- [Serving Static Content](/appengine/docs/legacy/standard/java/building-app/static-content)\n- [Handling Form Data](/appengine/docs/legacy/standard/java/building-app/handling-form-data)\n- [Using Cloud SQL](/appengine/docs/legacy/standard/java/building-app/cloud-sql)\n- [Executing Code Asynchronously](/appengine/docs/legacy/standard/java/building-app/taskqueues)"]]