Skip to content
OpenCms documentation
OpenCms documentation

Building the core

OpenCms uses the Gradle build tool for building the sources. 

The Gradle project

├── build.gradle
├── dependencies.gradle
├── gradle/
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

The figure above shows the Gradle files available in OpenCms' main project folder:

  • settings.gradle, build.gradle, and gradle.properties are the main configuration files as available in every Gradle project
  • the gradle/ directory together with the gradlew and gradle.bat files show that OpenCms makes use of a Gradle wrapper, which means, you do not have to install Gradle locally on your development computer but can use the local Gradle build tool bundled with the OpenCms source project
  • dependencies.gradle is an OpenCms specific Gradle configuration file that defines all build dependencies OpenCms needs

All gradle tasks can be executed using the Gradle wrapper shipped with OpenCms and with one of the available wrapper scripts:

  • Linux: ./gradlew <task>
  • Windows: graldew.bat <task>

Prints all available tasks.

The task builds the .zip-archive as it is downloaded when getting the OpenCms release for installation.

The task builds the OpenCms updater.

The task builds the opencms.war file as deployed to the servlet container.

The task builds the .zip file for the respective module, as you use it for module import.

The task builds the Java library (.jar) for the specified module.

The task removes all build results, i.e., cleans up.

The task installs the OpenCms *.jar files into your local Maven repository.

When you run a build target, the created files are placed in subfolders of the configured build_directory. In particular:

  • libs/ contains .jar files
  • classes/ contains .class files
  • modulesZip/ contains .zip files of modules (as imported in OpenCms)
  • distributions/ contains files for distribution, i.e., opencms.war, opencms-{version}.zip, updater.zip

By default, build_directory points to ../BuildCms/ relative to the source directory. To change the target folder, use the variable build_directory in the gradle.properties configuration file.