Gradle Build Overview

2024-04-18

This topic provides an overview of LabKey's Gradle-based build system.

General Setup

Before following any of the steps below, you'll need to Set Up a Development Machine, including completing the Gradle Configuration steps.

In the steps below, we use <LK_ENLISTMENT> to refer to the directory into which you checked out your enlistment (i.e., the parent of the server directory).

Your First Gradle Commands

1. Execute a gradle command to show you the set of currently configured projects (modules). You do not need to install gradle and should resist the urge to do so. We use the gradle wrapper to make updating version numbers easier. The gradle wrapper script (either gradlew or gradlew.bat) is included in the enlistment and is already in the <LK_ENLISTMENT> directory.

On the command line, type ./gradlew projects (Mac/Linux) or gradlew projects (Windows)

2. Execute a gradle command to build and deploy the application

./gradlew :server:deployApp

This will take some time as it needs to pull down many resources to initialize the local caches. Subsequent builds will be much faster.

Changing the Set of Projects

Gradle uses the <LK_ENLISTMENT>/settings.gradle file to determine which projects (modules) are included in the build. By default, all modules included in the <LK_ENLISTMENT>/server/modules are included. To exclude any of these modules, or otherwise customize your build, you will need to edit this file. See the file for examples of different ways to include different subsets of the modules.

Commonly Used Gradle Commands

For a list of commonly used Gradle tasks, see Build LabKey From Source.

Tips

See Gradle Tips and Tricks.

Cleaning

See the topic Gradle Cleaning.

IntelliJ Setup

Follow these steps in order to make IntelliJ able to find all the source code and elements on the classpath as well as be able to run tests.

Troubleshooting

See the trouble shooting section in Set Up a Dev Machine.

Related Topics