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
Light module
    ├── pom.xml
    └── src/
        └── main/
            ├── java/
            └── resources/
                ├── META-INF/
                │   └── magnolia/
                │       └── module-name.xml
                └── <module-name>/
                    ├── apps/
                    ├── dialogs/
                    │   └── myDialog.yaml
                    ├── webresources/
                    └── templates/
                        ├── components/
                        │   ├── myComponent.ftl
                        │   └── myComponent.yaml
                        └── pages/
                            ├── myTemplate.ftl
                            └── myTemplate.yaml
└── <module-name>/
    ├── apps/
    ├── dialogs/
    │   └── myDialog.yaml
    ├── module.yaml
    ├── webresources/
    └── templates/
        ├── components/
        │   ├── myComponent.ftl
        │   └── myComponent.yaml
        └── pages/
            ├── myTemplate.ftl
            └── myTemplate.yaml


  • magnolia.resources.dir is 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.properties and has the default value $magnolia.home. To see the current value of the property, see the list of properties in the About Magnolia app Config Info tab.
  • <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 $magnolia.resources.dir .
  • When creating a name for a module, do not use spaces, accented characters such as é, à, ç, ä, öü or special characters such as slashes /\ and so on. The name must match the regular expression [a-zA-Z0-9-_].

The page _CLI_PromotionBoxes was not found  -- Please check/update the page name used in the MultiExcerpt-Include macro

Module subfolders



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 directory.

By default $magnolia.resources.dir is the webapp folder, for instance magnoliaAuthor or magnoliaPublic. See Add the module folder to $magnolia.home for more information about $magnolia.home.

Creating a light module with Magnolia CLI

Using the Magnolia CLI you can create the folder structure for a light module with the command create-light-module. Open a shell, cd to your light modules directory, and execute the following command:

mgnl create-light-module one-pager-module
When creating a name for a module, do not use spaces, accented characters such as é, à, ç, ä, öü or special characters (e.g. slashes /\ and so on). The name must match the regular expression [a-zA-Z0-9-_] .

Note that this only works if you have installed Magnolia CLI, see Magnolia CLI Installation.

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.

Creating a Magnolia Maven module with Maven archetypes

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 https://nexus.magnolia-cms.com/content/groups/public/.

To choose an archetype:

  1. Create a directory on your local file system where the project will be stored and change into this directory.
  2. Execute the following maven command:

    mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=https://nexus.magnolia-cms.com/content/groups/public/ 

  3. Choose an archetype when prompted. Here we choose the option magnolia-module-archetype which is a simple Magnolia project wrapped into Maven structure. 

  4. Next, the script asks to choose the archetype version - we recommend to choose always the latest version.

  5. Now you must prompt typical Maven properties such as groupIdartifactIdpackage name and version plus the Magnolia specific parameters magnolia-bundle-versionmodule-class-name and module-name.
    When you have prompted all the parameters - the archetype summarizes your inputs and you must confirm or can skip.

    Define value for property 'groupId': : com.example
    Define value for property 'artifactId': : myModule
    Define value for property 'version':  1.0-SNAPSHOT: :
    Define value for property 'package':  com.example: :
    Define value for property 'magnolia-bundle-version': : 5.4.16
    Define value for property 'module-class-name': : MyModule
    Define value for property 'module-name':  myModule: :
    Confirm properties configuration:
    groupId: com.example
    artifactId: myModule
    version: 1.0-SNAPSHOT
    package: com.example
    magnolia-bundle-version: 5.4.16
    module-class-name: MyModule
    module-name: myModule
     Y: : Y

    If you confirm, Maven generates the archetype skeleton.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))