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
- Review the Magnolia CMS Certified Stack documentation (optional for Linux/Windows).
- Install JDK 8 from the official Oracle website.
- Install Maven version 3.2.3 or later.
- Update the Maven
settings.xmlfile located in the.m2folder:
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”:
- Navigate to your project directory:
1
cd ~/dev
- 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
- 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”:
- Navigate to
~/dev/wcand 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
- 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>
- 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.