Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Creating Build Automation with Gradle

Build Automation is an important part of continuous integration, and a necessary component of many automated pipelines. Gradle is a powerful build automation tool. This learning activity will guide you through the process of implementing a basic gradle build. After completing this activity, you should have a working knowledge of the basics of build automation in gradle.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Beginner
Last updated
Sep 21, 2025
Duration
1h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Your personal fork of the git repository is cloned to the cloud server

    You need to clone your personal fork of the sample git repository to the cloud server. Make sure you perform the clone from your home directory.

    You can do so like this:

     cd ~/
     git clone [email protected]:<your_username>/cicd-pipeline-train-schedule-gradle.git
    
  2. Challenge

    You initialized the project as a gradle project

    Once you have cloned the git repo to your home directory, cd into the repo directory and then initialize the gradle build.

     cd ~/cicd-pipeline-train-schedule-gradle
     ./gradlew init
    
  3. Challenge

    Your gradle build generates a zip archive of the application in `dist/trainSchedule.zip`

    The gradle build should generate an archive of the application in dist/trainSchedule.zip.

    You can do this by adding a task to create this archive to build.gradle and ensuring the build task depends on it.

    task zip(type: Zip) {
        from ('.') {
    	    include "*"
    	    include "bin/**"
    	    include "data/**"
    	    include "node_modules/**"
    	    include "public/**"
    	    include "routes/**"
    	    include "views/**"
        }
        destinationDir(file("dist"))
        baseName "trainSchedule"
    }
    
    build.dependsOn zip
    zip.dependsOn npm_build
    

    The full build.gradle file should look like this :

    plugins {
      id("com.github.node-gradle.node") version "2.2.4"
    }
    
    node {
      version    = '9.11.2'
      download   = true
    }
    
    task build
    
    task zip(type: Zip) {
      from ('.') {
        include "*"
        include "bin/**"
        include "data/**"
        include "node_modules/**"
        include "public/**"
        include "routes/**"
        include "views/**"
      }
      destinationDir(file("dist"))
      baseName "trainSchedule"
    }
    
    build.dependsOn zip
    zip.dependsOn npm_build
    build.dependsOn npm_build
    npm_build.dependsOn npmInstall
    npm_build.dependsOn npm_test
    npm_test.dependsOn npmInstall
    

    Then, execute the gradle build to generate the archive:

    ./gradlew build
    
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight