Overview
This page provides a quick overview of module development for experienced Magnolia developers.
Developers new to Magnolia should start with our Geolocation Module Tutorial.
An overview of Magnolia modules can be found at in our documentation on the Module Mechanism page.
Contents
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".
Avoid maven-archetype-magnolia-webapp and maven-archetype-magnolia-module, as they are quite outdated. Choose any of the others, depending on what you're doing.
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
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.
The 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.
The STK Theme archetype
The STK Theme archetype will produce a quickstart for an STK Theme.
The Project 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 !
The Magnolia Maven Archetypes if a Magnolia Forge project. 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:
- http://maven.apache.org/guides/introduction/introduction-to-archetypes.html
- http://maven.apache.org/guides/mini/guide-creating-archetypes.html
Host your module at the Forge!
Hey, why not share your new module with the world and host it at the forge ?
| Your Rating: |
![]() ![]() ![]() ![]()
|
Results: |
![]() ![]() ![]() ![]()
|
31 | rates |

5 Comments
Hide/Show CommentsMay 22, 2009
Giancarlo Berner
Is there already an Archetype for Modules in Magnolia 4.01 or 4.1?
Mar 17, 2011
Grégory Joseph
Sorry for the late reply, but yes, finally !
)
(you can even choose the Magnolia version when generating
May 02, 2011
Jozef Chocholacek
If you occur an
error when running
on your newly created module, here is the solution http://forums.atlassian.com/thread.jspa?threadID=34952&tstart=30.
Jun 17, 2011
Matt Dertinger
Way cool beans!
Love the new archetypes! Thank you Joerg and Greg!
In case anyone is interested, you may also add the archetypes to your local archetype-catalog as an alternative to passing in the
-DarchetypeCatalog=http://nexus.magnolia-cms.com/content/groups/public/argument.To do so:
~/.m2check to see if you already have anarchetype-catalog.xmlfile. If not, create one.archetype-catalog.xml, and add the magnolia archetypes you'd like to use, for instance:Jun 17, 2011
Grégory Joseph
True, but that'd mean maintaining that list (new archetypes, new versions, ...) - whereas our catalog is always up-to-date. (generated by Nexus).