New developers can start here. Step-by-step on how to create a new project and import it into Eclipse IDE.
Prerequisites
- Java 8 JDK Installed
- Maven Installed
- Suggested Maven 3.6+
- settings.xml created (See Maven setup).
Create the project
New Magnolia projects start with the archetype.
From the command line run:
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=https://nexus.magnolia-cms.com/content/groups/public/
Choose the archetype:
- An archetype to create STK Theme modules
- An archetype to create a Magnolia project (a parent pom and a webapp)
- An archetype to create basic Magnolia modules
- An archetype to create a Magnolia module to be hosted on the Magnolia Forge
- An archetype to create Magnolia modules using Blossom
Automates the creation of a Magnolia Cloud project: parent pom and webapp
An archetype to create a fresh Magnolia DX Core custom cloud bundle
Each archetype can have its own set of versions.
Choose info.magnolia.maven.archetypes:magnolia-project-archetype version:
- 1.1.0
- 1.2.0
- 1.2.1
- 1.2.2
- 1.2.3
- 1.2.4
- 1.2.5
- 1.2.6-SNAPSHOT
- 1.3
- 1.4-SNAPSHOT
Define the project:
groupId
| com.mycompany.webapps |
---|---|
artifactId
| magnolia-cms |
version
| 6.2.10-SNAPSHOT It can be helpful to align the project version with Magnolia version. |
package
| com.mycompany.webapps (press enter key to accept) |
magnolia-bundle-version
| 6.2.10 The magnolia-bundle-version is a version of a module collection. This can be different than core module version. |
project-name
| magnolia-cms |
Confirm success:
Confirm properties configuration: groupId: com.mycompany.webapps artifactId: magnolia-cms version: 6.2.10-SNAPSHOT package: com.mycompany.webapps magnolia-bundle-version: 6.2.10 project-name: magnolia-cms Y: : Y [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating project from Archetype: magnolia-project-archetype:1.4-SNAPSHOT [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: com.mycompany.webapps [INFO] Parameter: artifactId, Value: magnolia-cms [INFO] Parameter: version, Value: 6.2.10-SNAPSHOT [INFO] Parameter: package, Value: com.mycompany.webapps [INFO] Parameter: packageInPathFormat, Value: com/mycompany/webapps [INFO] Parameter: magnolia-bundle-version, Value: 6.2.10 [INFO] Parameter: package, Value: com.mycompany.webapps [INFO] Parameter: version, Value: 6.2.10-SNAPSHOT [INFO] Parameter: groupId, Value: com.mycompany.webapps [INFO] Parameter: project-name, Value: magnolia-cms [INFO] Parameter: artifactId, Value: magnolia-cms [INFO] Parent element not overwritten in /Users/rich.gange/magnolia-cms/magnolia-cms-webapp/pom.xml [INFO] project created from Archetype in dir: /Users/rich.gange/magnolia-cms [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 07:39 min [INFO] Finished at: 2021-07-06T09:26:00+02:00 [INFO] ------------------------------------------------------------------------
Bundles
Choose the bundle that you would like to use.
- Community Edition Bundle
- DX Core Edition Bundle
Be aware of the properties magnoliaVersion
and magnoliaBundleVersion
. The magnoliaVersion
refers to the main project version, which is a collection of modules including the core. The magnoliaBundleVersion
ties together a project with other resources. These numbers can diverge since a bundle release does not necessarily mean a new project release.
<properties> <magnoliaBundleVersion>6.2.10</magnoliaBundleVersion> <javaVersion>1.8</javaVersion> </properties> <!-- Option A --> <!-- Importing dependencyManagement of CE bundle. --> <!-- <dependency> <groupId>info.magnolia.bundle</groupId> <artifactId>magnolia-bundle-parent</artifactId> <version>${magnoliaBundleVersion}</version> <type>pom</type> <scope>import</scope> </dependency> --> <!-- Option B --> <!-- If you want to use the DX CORE. --> <dependency> <groupId>info.magnolia.dx</groupId> <artifactId>magnolia-dx-core-parent</artifactId> <version>${magnoliaBundleVersion}</version> <type>pom</type> <scope>import</scope> </dependency>
Webapps
Choose the webapp that you would like to use.
- Empty
- Community
DX Core
<!-- option i - magnolia-empty-webapp --> <!-- Dependencies versions are already imported by parent pom. Requires "Option A" in the parent pom. --> <!-- <dependency> <groupId>info.magnolia</groupId> <artifactId>magnolia-empty-webapp</artifactId> <type>pom</type> </dependency> <dependency> <groupId>info.magnolia</groupId> <artifactId>magnolia-empty-webapp</artifactId> <type>war</type> </dependency> --> <!-- option ii - magnolia-community-webapp --> <!-- Dependencies versions are already imported by parent pom. Requires "Option A" in the parent pom. --> <!-- <dependency> <groupId>info.magnolia.bundle</groupId> <artifactId>magnolia-community-webapp</artifactId> <type>pom</type> </dependency> <dependency> <groupId>info.magnolia.bundle</groupId> <artifactId>magnolia-community-webapp</artifactId> <type>war</type> </dependency> --> <!-- option iii - magnolia-dx-core-webapp --> <!-- Dependencies versions are already imported by parent pom. Requires "Option B" in the parent pom. --> <dependency> <groupId>info.magnolia.dx</groupId> <artifactId>magnolia-dx-core-webapp</artifactId> <type>war</type> </dependency> <dependency> <groupId>info.magnolia.dx</groupId> <artifactId>magnolia-dx-core-webapp</artifactId> <type>pom</type> </dependency>
Build the project
From the command line use maven to build the project. Execute the clean install from within the project directory.
mvn clean install
Eclipse users also need to explode the war file.
mvn war:inplace
Import the project
Import the project into your IDE. Here is an example using Eclipse 2020-12.
Import existing maven project
The archetype has created the poms needed for the project. Maven has built the project using those poms. Now import the project into the IDE as an existing maven project.
Server configuration
Using Tomcat 7 for development is recommended so that we can use the feature Serve modules without publishing.
VM Arguments
We recommend: -Xmx2048M