Search This Blog

Wednesday, November 14, 2018

How to build a Magnolia project with Maven

mvn archetype:generate -DarchetypeCatalog=https://nexus.magnolia-cms.com/content/groups/public/

You’ll get to choose which archetype to use in a list of archetypes. If the list hasn’t changed since writing this post, 5 should be your choice. (magnolia-project-archetype)

After entering some details about your project, this archetype will create an empty, ready-to-use, Maven structure with a top-level “project” and a webapp as a Maven sub-module. This might seem overkill for a simple project, but it will ease the transition if you want to add modules later on.

For the sake of the example, here are the values I used:

'groupId': ca.i88
'artifactId': cms
'version': 1.0-SNAPSHOT
'package': ca.i88
'magnolia-version': 5.3.9
'project-name':  cms

Let’s enter the project we just created, and build it.
cd cms
mvn clean install

Import this maven project into your favorite IDE and run the project.
Then open browser to http://localhost:8080 once it’s up and running.

Depends on your context root, you may need to visit:

http://localhost:8080/cms-webapp-1.0-SNAPSHOT

Go through the install screen, and once the installation is completed, you can see the screen:

Installation done.

152 tasks have been executed, for a total of 152 tasks.

Messages

Magnolia Core Module (version 5.3.9)

  • Please set the config:/server/defaultBaseUrl property to a full URL to be used when generating absolute URLs for external systems.

Magnolia Admincentral (version 5.3.9)

  • Property "pattern" was expected to exist at /server/filters/uriSecurity/bypasses/login with value "/.resources/loginForm" but has the value "/.resources/defaultLoginForm" instead.
login as superuser (password: superuser).