Dashboard > Magnolia Development > ... > Development Tips & Tricks > Create a New Module
Create a New Module Log In View a printable version of the current page.

Added by Teresa Miyar , last edited by GrĂ©gory Joseph on Sep 04, 2008  (view change)
Labels: 

Create a New Module

 Here are some suggestions on how to create a new module

The archetype

After running the plug-in you get two files:

MyModuleHandler.java: This module will be used to handle new versions no use for it the first time you create a module but it will be useful if in the next versions you decide to add new nodes, menu items...

MyModule.java:  It's the configuration bean of the new module, you can extend it as you like and it will be automatically loaded into a bean using the Content2Bean class. In case your configuration doesn't follow the Content2Bean specification you can load your bean manually by iterating yourself over the nodes or give a class to get the configuration loaded into it.

One thing worth mention is the class  ModuleLifecycle that you can implement in the module class, it allows you to perform actions on startup and shutdown (and thus restart) of your module.

A primer on the new archetype

MPARCH-9@jira, MPARCH-10@jira
For "internal" modules (i.e those on our svn), I just (2008-08-28) started a new archetype. I'll try to update the existing ones soon, because the new version (2.0) is much more powerful.
Here's how one could use it:

mvn archetype:generate -DarchetypeCatalog=local

That's it! All other options are asked by the plugin itself. Sweet.
2.0-alpha-4 will hopefully include my fix for ARCHETYPE-200, and hopefully will let us also rename all those mymodule directories as well as the module descriptor ! (ARCHETYPE-191)

Supposedly, after creating archetypes, one should generate the catalog and then upload it:
mvn archetype:crawl -DcatalogFile=archetype-catalog.xml
http://maven.apache.org/plugins/maven-archetype-plugin/specification/archetype-catalog.html
http://maven.apache.org/plugins/maven-archetype-plugin/crawl-mojo.html

Whenever i figure out how the catalogs are supposed to be published, one will probably just have to point to the correct catalog with -DarchetypeCatalog instead of using the local one.

Powered by a free Atlassian Confluence Open Source Project License granted to Magnolia International. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators