OpenCms uses the Gradle build tool for building the sources.
The Gradle project
├── build.gradle
├── dependencies.gradle
├── gradle/
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradleThe figure above shows the Gradle files available in OpenCms' main project folder:
settings.gradle,build.gradle, andgradle.propertiesare the main configuration files as available in every Gradle project- the
gradle/directory together with thegradlewandgradle.batfiles 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.gradleis an OpenCms specific Gradle configuration file that defines all build dependencies OpenCms needs
Interesting Gradle tasks
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>
- Linux:
- tasks
Prints all available tasks.
- bindist
The task builds the
.zip-archive as it is downloaded when getting the OpenCms release for installation.- updater
The task builds the OpenCms updater.
- war
The task builds the
opencms.warfile as deployed to the servlet container.- dist_{module name}
The task builds the
.zipfile for the respective module, as you use it for module import.- jar_{module name}
The task builds the Java library (
.jar) for the specified module.- clean
The task removes all build results, i.e., cleans up.
- install
The task installs the OpenCms
*.jarfiles 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.jarfilesclasses/contains.classfilesmodulesZip/contains.zipfiles 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.