Gradle  – Deploy Java web apps to Azure in one step!

Yuchen

We are excited to announce a new Gradle plugin for Azure Web Apps. Many Java on Azure developers use Gradle because of its customizable features and other advantages. With this new Gradle plugin, these developers can continue their Gradle journey and deploy Java Web apps to Azure in one single step.

gradle azureWebAppDeploy

Like Maven plugins for Azure services, the new Gradle plugin is:

  • Simple to use: get infrastructure as code by defining everything in your “build.gradle” and applying changes to Azure with a single deploy task.
  • Platform agnostic with zero set-up time: regardless Win, Linux, or Mac, declaring this plugin in your “build.gradle” will install it immediately.
  • Flexible with authentication: use Azure CLI, OAuth or Service Principal to authenticate with Azure.
  • CI/CD friendly: embed the plugin and task in your DevOps automation platform and tools like Azure Pipelines, Jenkins, or GitHub Actions.

The new plugin saves developers time by reducing a complex process to just one step. Try out with these simple instructions.

Try it now!

  1. Add Gradle plugin for Azure Web App to your “build.gradle” file:
    plugins {
        id "com.microsoft.azure.azurewebapp" version "1.1.0"
    }     
    
  2. Configure this plugin in the “build.gradle” file or “gradle.properties”:
    azurewebapp {
        subscription = '<your subscription id>'
        resourceGroup = '<your resource group>'
        appName = '<your app name>'
        pricingTier = 'P1v2' 
        region = 'westus' 
        runtime {
            os = 'Linux' 
            webContainer = 'Tomcat 9.0'
            javaVersion = 'Java 8'
        }
    }

    You can customize the task – for example, you can specify the App Service pricing tier, runtime stack, application settings, Azure regions, etc.

  3. Deploy the app:
    gradle azureWebAppDeploy

    Once deployment has completed, your application will be ready at: <your app name>.azurewebsites.net

Resources and feedback

1 comment

Leave a comment

  • Bjego

    Nice, but you shouldn’t do it in an professional environment. You should build your code once and ship the already buid binaries it with a deployment pipeline maybe as a container or whatever.