A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/appengine/docs/standard/java/using-gradle below:

Using Gradle and the App Engine Plugin | App Engine standard environment for Java 8

Using Gradle and the App Engine Plugin

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 begin

Install and configure the following prerequisites:

Setting up and validating your Google Cloud project

You need to set up your Google Cloud project and install the gcloud CLI:

  1. Use the Google Cloud console to create and set up your Google Cloud project:

    Go to App Engine

    1. Select or create a new Google Cloud project.
    2. Follow the prompts to ensure that an App Engine application exists and billing is enabled:
      1. If you need to create an App Engine application for your project, you are prompted to select the region where you want your App Engine application located.
      2. Follow the prompts to create a new billing account or select an existing account.
    3. The Dashboard opens after your App Engine application has been created and billing has been enabled in your project.
  2. You don't need to install the gcloud CLI because the plugin automatically installs the SDK when required.

Creating a new Gradle project

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.

  1. Create and enter a new directory.

  2. 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
    
  3. 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:

  4. 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 app
  1. Clone 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.

  2. Change to the directory that contains the sample code:

    cd java-docs-samples/appengine-java8/helloworld
    
Testing your application with the development server
  1. To access Google resources from your project when running locally, set the application default credentials by running:

    gcloud auth application-default login
    
  2. Change to the root of your application directory.

  3. 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.

  4. 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
    
  5. See your app running at http://127.0.0.1:8080.

Debugging on the development server

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:

Deploying your 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.

Using the Gradle wrapper

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 next

Except 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