What is a Module?
- A Module is a type of Java JAR file called an "OSGi Bundle" and is stored in
- They are specially designed plug-ins for building upon Jahia’s infrastructure and services. They can
- Define new types of content like articles, news items, and sports events
- Add features on sites like Tagcloud and Google Analytics
- Extend the technology stack like OpenSocial, and LDAP
Portability and reusability
Module are independent from each other and reusable across projects.
Easy to maintain
All of a module's required elements are packaged in a single directory. As such, module updates can be performed independently from the rest of the platform.
A defective module does not cause a general error on a page or site.
For large projects, it is easier to divide the work between developers with each being responsible for a set of modules.
Jahia Developers work on Modules by...
- Modifying or adapting Modules provided out-of-the-box
- Deploying new Modules from the Jahia AppStore
- Creating new Modules from scratch
A Module's Contents
The standard structure of a Jahia module is generated with a Maven archetype. The Felix Maven Bundle plugin then generates an OSGi bundle out of the maven project.
A Module can contain:
Scripts (jsp, JSR 283, php)
Static resources (text, images, css, js)
Properties files and resource bundles
Spring configuration files
Data files (XML)
How to Create a Module
Modules can be created with Apache Maven using a command like the one below:
mvn archetype:generate -Dfilter=org.jahia.archetypes:
In the menu choose archetype number 2 :
Module creation requires a specified name, artifactId, and Jahia version.
See the Module Creation tutorial here: Module Management Tutorial
In Eclipse, a Module is created with a new Maven project.
For Jahia modules, the remote catalogue http://maven.jahia.org/maven2 is used.
Using Jahia Studio
- "New Module" can be found in the "New" dropdown
- The running Jahia version number is auto-populated.
Enabling a Module
To make a Module available to editors it must first be enabled. This can be done from Administration mode under Components/Modules. In the “Usage in sites” area, the 'Enable' button would be selected on the relevant site.
Exercise: Create a Module
- In Jahia Studio, create a new module.
- Ensure it's created as a 'module' type.
- Name the Module “acmeCompany”.