Stay organized with collections Save and categorize content based on your preferences.
You can use Gradle, a flexible build automation system that is declarative and is used to automate build, testing, publishing, and deployment. This page explains how to use Gradle with an App Engine project in the standard environment.
Before you beginInstall and configure the following prerequisites:
Install Gradle (v3.4.1 or newer)
You need to set up your Google Cloud project and install the gcloud CLI:
Use the Google Cloud console to create and set up your Google Cloud project:
You don't need to install the gcloud CLI because the plugin automatically installs the SDK when required.
You can create a new Gradle project from scratch using the shell. Alternatively, to try out the plugin, you can download, run locally, and deploy the hello world project.
Create and enter a new directory.
To initialize a new project:
gradle init --type java-library;
mkdir -p src/main/webapp/WEB-INF;
rm src/main/java/Library.java src/test/java/LibraryTest.java
Add the following to your build.gradle
file to add App Engine Gradle tasks, Maven repositories, the App Engine Gradle plugin, dependencies, and task configuration:
You also need to add the following files to your project, using a text editor or integrated development environment (IDE):
See Configuration files for an overview of a Java App Engine project.
Downloading the Hello World appClone the Hello World sample app repository to your local machine:
git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git
Alternatively, you can download the sample as a zip file and extract it.
Change to the directory that contains the sample code:
cd java-docs-samples/appengine-java8/helloworld
To access Google resources from your project when running locally, set the application default credentials by running:
gcloud auth application-default login
Change to the root of your application directory.
During the development phase, you can run and test your application at any time in the development server by invoking Gradle:
gradle appengineRun
Alternatively, you can run Gradle without installing it by using the Gradle wrapper.
Wait for the server to start. The server is started with your application running when you see a message similar to this:
:compileJava :processResources NO-SOURCE :classes :war :explodeWar :assemble :appengineRun 2018-06-05 22:50:46.231:INFO::main: Logging initialized @321ms Jun 06, 2018 2:50:49 AM com.google.appengine.tools.development.AbstractModule startup INFO: Module instance default is running at http://localhost:8080/ Jun 06, 2018 2:50:49 AM com.google.appengine.tools.development.AbstractModule startup INFO: The admin console is running at http://localhost:8080/_ah/admin Jun 05, 2018 10:50:49 PM com.google.appengine.tools.development.DevAppServerImpl doStart INFO: Dev App Server is now running
See your app running at http://127.0.0.1:8080
.
To debug a locally running application, set the jvmFlags
property to enable debugging on the underlying JVM, for example:
appengine {
run {
jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
}
}
Enable hot reload of the application
Hot Reloading is the ability to update one or more classes in an application that is currently running without stopping the environment. To enable hot reload:
You must tell the local server to scan for changes:
appengine {
run {
automaticRestart = true
}
}
While your app is running, run the explodeWar
task to copy the changes into the exploded app directly and propagate your changes into the running application.
To deploy your application:
gradle appengineDeploy
The appengineDeploy
task and all other Gradle tasks have associated properties that you can use. For a complete list of tasks and properties, refer to App Engine Gradle Tasks and Properties.
Gradle provides a mechanism to download and run the required version of Gradle without installation:
Linux/macOS./gradlew appengineRun
Windows
gradlew.bat appengineRun
Additional information on Gradle can be found in App Engine Gradle Tasks and Properties.
What's nextExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Gradle, a declarative build automation system, is used to automate building, testing, publishing, and deploying App Engine projects in the standard environment."],["Setting up a Google Cloud project, including creating an App Engine application and enabling billing, is necessary before using Gradle with App Engine."],["A new Gradle project can be created and initialized using the shell, requiring the addition of App Engine Gradle tasks, Maven repositories, and dependencies to the `build.gradle` file."],["The application can be tested locally using the development server with the command `gradle appengineRun`, and debugging can be enabled by setting `jvmFlags` in the `appengine` configuration."],["Deploying the application is done through the `gradle appengineDeploy` command, and the Gradle wrapper can be used as an alternative method to run Gradle without installation."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4