A Magnolia module can be purely file based or it can be wrapped in a Maven project.
|Magnolia module wrapped in a typical Maven module |
structure before it is built.
|File-based Magnolia module under $magnolia.resources.dir|
magnolia.resources.diris a property defining the directory from which resources are loaded in a Magnolia instance. This directory is used for file-based resources such as light modules and for overriding classpath resources. The property is configured in
WEB-INF/config/default/magnolia.propertiesand has the default value
$magnolia.home/modules. To see the current value of the property, go to the Config Info tab in the About Magnolia app.
You can use symbolic links (a.k.a symlinks or soft links) in the resources directory to include light modules located elsewhere on your system.
<module-name>folder contains exactly the same content in a Maven module and folder-based module. In a Maven module this folder is within
src/main/resources. In a folder-based modules this folder is within
Avoid spaces and special characters (ü, ä, ö) in
Configuration data for apps (YAML files)
Definition decorator files (YAML files)
Dialogs (YAML files), may have subfolders
FieldType definitions (YAML files).
i18n message bundle (.properties files).
MessageView definitions (YAML files).
All the web resources, typically contains subfolders. (Folder name is arbitrary.)
Template definitions (YAML files) and scripts with subfolders
Folder-based module in $magnolia.resources.dir
Starting with Magnolia 5.4, a Magnolia module does not have to be a Maven module. You can add a file-based module in the
$magnolia.resources.dir is the webapp folder, for instance
magnoliaPublic. See Add the module folder to $magnolia.home for more information about
Magnolia Maven module
If you are familiar with Java and Maven you may want to use Maven to create and build your Magnolia module. Using Maven eases the process of creating a JAR file, deployment, and dependency management of your modules. All modules provided by Magnolia are built with Maven. This makes it easy to install or uninstall them by adding or removing a JAR file.
Magnolia provides a Maven archetype to build the skeleton of a Magnolia Maven module. The archetype provides options to build different modules:
- Basic Magnolia module
- Theme module
- Magnolia module to be hosted on the Magnolia Forge
- Magnolia module using Blossom
- Magnolia project (a parent pom and a webapp))
The archetypeCatalog is in
To choose an archetype:
- Create a directory on your local file system where the project will be stored and change into this directory.
Execute the following maven command:
Choose an archetype when prompted. Here we choose the option
magnolia-module-archetypewhich is a simple Magnolia project wrapped into Maven structure. Maven will then ask us for the standard Maven properties such as which version of Magnolia we will be using.