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
, andgradle.properties
are the main configuration files as available in every Gradle project- the
gradle/
directory together with thegradlew
andgradle.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
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.war
file as deployed to the servlet container.- dist_{module name}
The task builds the
.zip
file 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
*.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
filesclasses/
contains.class
filesmodulesZip/
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.