Gradle properties can be set in four different places:

  • Globally - Global properties are applied at the user or system-level. The intent of global properties is the application of common settings across multiple Gradle projects. For example, using globally applied passwords makes maintenance easier and eliminates the need to copy passwords into multiple areas.
  • In a Project - Project properties apply to a whole Gradle project, such as the LabKey Server project. Use project-level properties to control the default version numbers of libraries and other resources, and to control how Gradle behaves over the whole project, for example, whether or not to build from source.
  • In a Module - Module properties apply to a single module in LabKey Server. For example, you can use module-level properties to control the version numbers of jars and other resources.
  • On the command line, for example: -PbuildFromSource=false
Property settings lower down this list override any settings made higher in the list. So a property set at the Project level will override the same property set at the Global level, and a property set on the command line will override the same property set at the Global, Project, or Module levels. See the Gradle documentation for more information on setting properties.

Global Properties

The global properties file should be located in your home directory:

  • On Windows: C:\Users\<you>\.gradle\
  • On Mac/Linux: /Users/<you>/.gradle/
A template global properties file is available at <LK_ENLISTMENT>/gradle/global_gradle.properties_template in your enlistment. For instructions on setting up the global properties file, see Set Up a Development Machine.

Some notable global properties are described below:

  • deployMode - Possible values are "dev" or "prod". This controls whether a full set of build artifacts is generated that can be deployed to production-mode servers, or a more minimal set that can be used on development mode machines.
  • systemProp.tomcat.home - Value is the path to the Tomcat home directory. Gradle needs to know the Tomcat home directory for some of the dependencies in the build process. IntelliJ does not pick up the $CATALINA_HOME environment variable, so if working with the IntelliJ IDE, you need to set the tomcat.home system property either here (i.e., as a global Gradle property) or on the command line with
    -Dtomcat.home=/path/to/tomcat/home. Regardless of OS, use the forward slash (/) as a file separator in the path (yes, even on Windows).
  • includeVcs - We do not check the value of this property, only its presence or absence. If present, the population of VCS revision number and URL is enabled in the file. Generally this is left absent when building in development mode and present when building in production mode.
  • artifactory_user - Your artifactory username (if applicable)
  • artifactory_password - The password for the above account, if applicable.

Project Root Properties

The project properties file resides at:

For the most part, this file sets the version numbers for external tools and libraries, which should not be modified.

Notable exceptions are described below:

  • buildFromSource - Indicates if we should use previously published artifacts or build from source. This setting applies to all projects unless overridden on the command line or in a project's own file. The default properties file in <LK_ENLISTMENT>/ sets buildFromSource to "true". This setting will cause a build command to construct all the jars and the .module files that are necessary for a server build. If you are not changing code, consider setting "buildFromSource=false". The following table illustrates how you can buildFromSource to build just the source code you need to build.
If you want to......then...
Build nothing from sourceSet buildFromSource=false and run "gradlew deployApp".
Build everything from sourceSet buildFromSource=true and run "gradlew deployApp".
Build a single module from sourceSet buildFromSource=false and run the deployModule command for that module (for example, "gradlew :server:modules:wiki:deployModule").
Alternatively, you could create a file within the module you want to build from source, include the setting "buildFromSource=true", and call "gradlew deployApp".
Build a subset of modules from sourceSet buildFromSource=false and run the deployModule command for the subset of modules you wish to build.
Alternatively, you could create files within the modules you want to build from source, include the setting "buildFromSource=true" in each, and call "gradlew deployApp".

Note that, unlike other boolean properties we use, the value of the buildFromSource property is important. This is because we want to be able to set this property for individual modules and the mere presence of a property at a higher level in the property hierarchy cannot be overridden at a lower level. If the property is defined, but not assigned a value, this will have the same effect has setting it to false.

Community developers who want to utilize 'buildFromSource=false' will need to limit the list of modules built. Use a custom manifest of modules, such as 'local_settings.gradle', as described in the topic Customize the Build.

  • labkeyVersion - The default version for LabKey artifacts that are built or that we depend on. Override in an individual module's file as necessary.

Module-Specific Properties

This is most commonly used to set version number properties for the dependencies of a particular module, which, while not necessary, is a good practice to use for maintainability. An example module-specific properties file, from /server/test that sets various version properties:


Other common properties you may want to set at the module level:

  • skipBuild - This will cause Gradle to not build artifacts for this module even though the module's Gradle project is included by the settings.gradle file. We do not check the value of this property, only its presence.
  • buildFromSource - As mentioned above, this will determine whether a module should be built from source or whether its artifacts should be downloaded from the artifact repository. We do check the value of this property, so it should be set to either true or false. If the property is set but not assigned a value, this will have the same effect as setting it to false.

Was this content helpful?

Log in or register an account to provide feedback

expand allcollapse all