Project on Magnolia CMS Community Edition from Scratch

Evgeniy Fitsner Software Engineer
2 min read
Project on Magnolia CMS Community Edition from Scratch

Introduction

This guide covers creating a Magnolia CMS project using the Community Edition from the ground up. The steps were tested on Linux (Linux Mint) but are adaptable to other operating systems.

This article targets Magnolia version 5.5.4.

Prerequisites

  1. Review the Magnolia CMS Certified Stack documentation (optional for Linux/Windows).
  2. Install JDK 8 from the official Oracle website.
  3. Install Maven version 3.2.3 or later.
  4. Update the Maven settings.xml file located in the .m2 folder:
1
2
mvn org.sonatype.plugins:nexus-m2settings-maven-plugin:1.6.8:download \
  -DnexusUrl=https://nexus.magnolia-cms.com

Initial Installation

Create a modular Magnolia CMS project named “wc”:

  1. Navigate to your project directory:
1
cd ~/dev
  1. Generate the base project structure using the Maven archetype:
1
2
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \
  -DarchetypeCatalog=https://nexus.magnolia-cms.com/content/groups/public/

Configuration selections:

  • Select: magnolia-project-archetype
  • Version: 1.2.3-SNAPSHOT
  • GroupId: com.drfits.wc
  • ArtifactId: wc
  • Version: 1.0.0-SNAPSHOT
  • Magnolia version: 5.5.4
  1. Build and verify:
1
mvn clean install

A successful build produces: ~/dev/wc/wc-webapp/target/wc-webapp-1.0.0-SNAPSHOT.war

Adding Modules

Create a custom core module named “wc-core”:

  1. Navigate to ~/dev/wc and execute:
1
2
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \
  -DarchetypeCatalog=https://nexus.magnolia-cms.com/content/groups/public/

Configuration selections:

  • Select: magnolia-module-archetype
  • GroupId: com.drfits.wc
  • ArtifactId: wc-core
  • Version: 1.0.0-SNAPSHOT
  • Package: com.drfits.wc.core
  • Magnolia version: 5.5.4
  • Module class name: WCCore
  1. Add the module dependency to ~/dev/wc/wc-webapp/pom.xml:
1
2
3
4
5
<dependency>
    <groupId>com.drfits.wc</groupId>
    <artifactId>wc-core</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</dependency>
  1. Build the complete project:
1
mvn clean install

Result

This establishes a modular Magnolia CMS project with a custom core module integrated into the deployable WAR archive. You can deploy the WAR file to any servlet container like Tomcat or Jetty to run your Magnolia CMS instance.

Contents