This page provides a quick overview of module development for experienced Magnolia developers. An overview of Magnolia modules can be found at in our documentation on the Modules page.
Using a Maven Archetype
You can use Maven 2's archetype plugin to quickly get started with creating a module or project.
Use this command:
You will first be prompted to "Choose an archetype".
You will further be prompted for various properties, whose names should hopefully be obvious enough for you to figure what to enter. If not, try some random value, see the results and try again (Please vote for this maven-archetype-plugin enhancement !)
The module archetype will generate a basic Magnolia module, including all necessary folders, a module descriptor and two classes:
- a module configuration class, named after the
module-class-nameproperty. See http://documentation.magnolia-cms.com/technical-guide/modules.html#Module_class for details.
- a module version handler class, similarly named, in the
.setupsubpackage. See http://documentation.magnolia-cms.com/technical-guide/modules.html#Version_handling for details.
Forge Module archetype
The Forge module archetype is very similar, but will provide a
pom.xml with sensible defaults for use for a project hosted on the Magnolia Forge.
STK Theme archetype
The Project archetype will produce a skeleton for a "project"; this will contain
- a parent pom
- a webapp, overlaying
magnolia-empty-webapp, ready to host your custom configuration files.
If you want to add a module to an existing project, generating the
module artifact from within your project should get you started quickly, as it will adapt the new artifact's parent pom to match your existing project !
Changing a project from CE to EE
When you create a project using an archetype from the
public group you get a Community Edition (CE) project. This means the project has dependencies to the CE bundle and you get only community modules. If you need a more substantial starting point, change the dependencies in your POM files to the Enterprise Edition (EE) bundle and webapp. This way you get enterprise modules such as Multisite and Workflow.
There are two videos in Magnolia Academy that explain how to work with Module Dependencies.
In your project POM, set:
In your webapp POM, set:
Setting the File Encoding
If you see a warning about file encoding:
See https://maven.apache.org/general.html#encoding-warning for instructions.
Have a look at http://jira.magnolia-cms.com/browse/ARCH to see known problems or suggest new features.
Please try it out and tell us what you think !
More info about Maven archetypes:
Host your module at the Forge!
Hey, why not share your new module with the world and host it at the forge?