Creating a new module

November 14, 2023

Using a Maven Archetype

We provide a Maven archetype to get started quickly with a new project. The steps below guide you through the process of creating a new project.

  1. Create a new project using a Maven Archetype:
    mvn archetype:generate -Dfilter=org.jahia.archetypes:
    (do not forget the colon at the end of the filter value)
  2. Select the required archetype, e.g.:
    2: remote -> org.jahia.archetypes:jahia-module-archetype (Archetype for creating a new module project to be run on a Jahia server)
  3. Chose the latest archetype version available from the list
  4. Enter project metadata and confirm
  5. Change into project directory and build using:
    mvn clean install

You can then open the Maven project in your favorite IDE and start building your Jahia OSGi module.

OSGi enables you to hot deploy packaged modules at runtime. Deploy-free coding builds on top of OSGi's capabilities and makes it possible to use changes made in file's source code without needing any redeployment. Deploy-free coding only requires an initial deployment using Jahia's Maven plugin.

Releasing modules

When releasing modules, it is recommended that you remove the Jahia-Source-Folders configuration attribute from the Felix Maven Bundle plugin configuration. This is just to avoid any potential lookups in case the source folders also exist on the server. It will also prevent unnecessary file lookups.