YAML-based module descriptor
This page is about the YAML-based module descriptor for a Magnolia light module and details light module dependencies. If you are using a Magnolia Maven module, you should use an XML-based module descriptor.
The file must be in the root folder of the module and its name has to be
module.yaml
.
The YAML-based module descriptor allows you to define the version of the module and dependencies to other Magnolia modules.
Example
version: 1.0
dependencies:
core:
version: 5.4.7
cache:
version: 5.4.5
optional: true
Module descriptor elements
Property | Description |
---|---|
|
required The module versions. |
|
optional Dependencies on other modules - the module will install only after the specified modules. |
Module versions
The syntax for a version is
from version / to version
where the version number consists of three parts: x.y.z
. The x.y
parts denote a major version
and the z
part a maintenance release. The y.z
parts are optional. For a strict version
dependency, use just one version string.
The info.magnolia.module.model.VersionRange class supports the following syntax to indicate version dependencies. Only three parts are supported: major, minor and security versions. The build number is not supported. See Runtime.Version for more information.
-
*
: all versions.In a YAML file, make sure to wrap *
with quotes (version: "*"
). -
1.2
: version 1.2 only. -
1.2/*
: version 1.2 or higher. -
1.2/1.2.9
or[1.2,1.2.9]
: all versions between 1.2 and 1.2.9 (including 1.2 and 1.2.9). -
[1.2,1.2.9[
or[1.2,1.2.9)
: all versions between 1.2 and 1.2.9 (including 1.2 but excluding 1.2.9).
Example | Description |
---|---|
|
Major version 3. |
|
Major version 3.6. |
|
Major version 3.6 and maintenance version 3. |
|
Major version 3 or higher. |
|
Major version 3.6 or higher. |
|
Major version 3.6 and maintenance version 3 or higher. |
|
Major version 3 or earlier. |
|
Major version 3.6 or earlier. |
|
Major version 3.6 and maintenance version 3 or earlier. |
|
All versions between 3.5 and 3.6.2 (including 3.5 and 3.6.2). |
|
All versions between 3.5 and 3.6.2 (including 3.5 but excluding 3.6.2). |
Module dependencies
You can define runtime or install time dependencies (not build dependencies). If you define a dependency on a module, then this module will be installed and started before your module. A dependency can be optional. Optional in this context means that if an optional module is not present, installation will proceed, but if the optional module is present, this module will be installed first. The dependencies could look like this:
- $magnolia.resources.dir/example-light-module/module.yaml
version: 1.0
dependencies:
core:
version: 5.4.7
# If the Cache module is present, install the current module
# after Cache so we can add a cache bypass.
cache:
version: 5.4.5
optional: true
Module dependencies define module loading order
The module dependencies define the order in which modules are loaded
during startup. For example, if module-a
depends on module-b
,
module-b
will be loaded before module-a.
The order becomes
important, for example, if both module-a
and module-b
decorate the
same definition or if module-a
inherits a definition from module-b
.
Decorations are applied in the module load order. |