Developers who build LabKey Server from source will not be able to use the Ant build targets starting in 17.2 (July 2017). Instead, the Gradle build framework will be used. This topic is intended for developers who want to migrate their already existing LabKey Server development environment from Ant to Gradle. If you want to build a new development environment from scratch use the following topic instead: Set Up a Development Machine.

For the latest news on the migration to Gradle, see Gradle Developer Discussion Thread.


It is assumed in what follows that you have a standard LabKey SVN enlistment.  We use LABKEY_ROOT to refer to the directory into which you check out your enlistment (i.e., the parent of the server directory). (You may also have git modules checked out, but the first step will be to get a build using SVN modules going.)

General Setup

Complete the Gradle Config steps in the topic 'Set Up a Development Machine'.

Your First Gradle Commands

1. Clean out the ant build directories and files

ant clean

2. 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 SVN sync and is already in the <LABKEY_ROOT> directory. 

On the command line, type ./gradlew projects (or gradlew.bat projects)

3. 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 <LABKEY_ROOT>/settings.gradle file to determine which projects (modules) are included in the build.  (This is an analog of the various .modules files used in the ant build.)  To include a different set of projects in your build, you will need to edit this file.  By default, only modules in the server/modules directory and the server/test and server/test/modules directories are included in the build.  See the file for examples of different ways to include different subsets of the modules.  

Ant-to-Gradle Command Line Mapping

The following table provides a mapping between the most popular (I assume) ant commands and their Gradle counterparts. Note that while a mapping is provided for the ‘ant clean’ and ‘ant rebuild’ commands to get you oriented, these commands should no longer be used automatically with each new day or each new sync from SVN.  Gradle handles checking for needed updates much better and so you do not need to proactively clean as often.

Ant Command

Gradle Command

ant build

gradlew deployApp

ant clean

gradlew cleanBuild

ant rebuild

gradlew cleanBuild deployApp

ant pick_pg

gradlew pickPg

ant pick_mssql

gradlew pickMSSQL

ant dist

gradlew distribution

ant wiki

gradlew :server:modules:wiki:deployModule

ant wiki

gradlew deployModule

ant test

gradlew :server:test:uiTest

ant drt

gradlew :server:test:uiTest -Psuite=DRT

ant production

gradlew deployApp -PdeployMode=prod


See Gradle Tips and Tricks.


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.


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

Related Topics





expand all collapse all