Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This tutorial page explains how you can create a full-featured Enterprise Edition Pro DX Core Magnolia webapp from a Magnolia Maven archetype. If you'd like to try creating a minimalistic webapp, see Creating a minimal webapp with Maven. For a general overview page, please refer to Creating a custom webapp with Maven.

Note

To complete this tutorial, you need Magnolia credentials to access the Magnolia Enterprise Edition repositoriesDX Core repositories.

Table of Contents
maxLevel2

...

In the steps below, you use the magnolia-enterprisedx-procore-webapp as the base and exclude the following two modules from it:

...

  1. Create and switch to a directory where you want to create the new webapp, for example ~/dev/repo/magnolia.
  2. Open a shell and enter the following Maven command: Multiexcerpt includeSpaceWithExcerptDOCS61MultiExcerptNamedirect-command_webappPageWithExcerptHow to use Magnolia Maven archetypes

    Code Block
    mvn archetype:generate -DarchetypeGroupId=info.magnolia.maven.archetypes -DarchetypeArtifactId=magnolia-project-archetype -DarchetypeVersion=RELEASE
  3. When prompted to supply values for archetype parameters, enter the following:

    Code Block
    groupId: com.example
    artifactId: custom-eedx-procore-project
    version: 1.0-SNAPSHOT
    package: com.example
    magnolia-bundle-version: 6.02
    project-name: custom-eedx-procore-project
  4. Confirm the configuration by entering y

...

Code Block
linenumberstrue
custom-eedx-procore-project
├── custom-eedx-procore-project-webapp
│   ├── pom.xml
│   └── src
└── pom.xml

...

Code Pro
https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/custom-ee-pro-project/raw/pom.xml?at=master
languagexml
titlecustom-eedx-procore-project/pom.xml
collapsetrueurl
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>custom-dx-core-project</artifactId>
  <name>custom-dx-core-project (parent pom)</name>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <properties>
    <magnoliaBundleVersion>6.2</magnoliaBundleVersion>
    <javaVersion>1.8</javaVersion>
  </properties>
  <!-- Fill the following in, so you can use the release plugin -->

  <scm>
    <connection/>
    <developerConnection/>
    <url/>
  </scm>

  <dependencyManagement>
    <dependencies>
      <!-- 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>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
          <source>${javaVersion}</source>
          <target>${javaVersion}</target>
        </configuration>
      </plugin>
    </plugins>
    <!-- default resources configuration which will filter your module descriptors -->
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
        <includes>
          <include>META-INF/magnolia/*</include>
        </includes>
      </resource>
    </resources>
  </build>

  <repositories>
    <repository>
      <id>magnolia.public</id>
      <url>https://nexus.magnolia-cms.com/content/groups/public</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <!-- IF YOU NEED MODULES FROM THE ENTERPRISE VERSION, UNCOMMENT THE FOLLOWING REPOSITORY -->
    <repository>
      <id>magnolia.enterprise.releases</id>
      <url>https://nexus.magnolia-cms.com/content/repositories/magnolia.enterprise.releases</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>vaadin-addons</id>
      <url>https://maven.vaadin.com/vaadin-addons</url>
    </repository>
  </repositories>

  <modules>
    <module>custom-dx-core-project-webapp</module>
  </modules>

</project>

Editing the webapp POM

In the webapp POM file, modify the dependencies section.

  1. Uncomment the option iviii.
  2. Remove the other options (i,  and ii and iii).
  3. Exclude the Content Translation Support and Marketing Tags modules.
    To exclude them, you have to add the exclusions section with an exclusion tag for each module. This should be done within the pom type dependency of the magnolia-enterprisedx-procore-webapp.
    (See also https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html.)

    Here is the result:

    Code Pro
    https://git.magnolia-cms.com/projects/DOCUMENTATION/repos/custom-ee-pro-project/raw/custom-ee-pro-project-webapp/pom.xml?at=master
    languagexml
    titlecustom-eedx-procore-project/custom-eedx-procore-project-webapp/pom.xml
    collapsetrueurl
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <groupId>com.example</groupId>
        <artifactId>custom-dx-core-project</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
      </parent>
      <artifactId>custom-dx-core-project-webapp</artifactId>
      <name>custom-dx-core-project: webapp</name>
      <packaging>war</packaging>
      <dependencies>
        <!--
         Add your project specific dependencies here:
         A custom webapp typically is based on a magnolia webapp. The most simple and reduced bundle to start with is the "magnolia-empty-webapp" (see "option i" below).
         To see a complete list of preconfigured Magnolia webapps, have a look at https://documentation.magnolia-cms.com/display/DOCS/Bundles+and+webapps
         => Please just use one of the four below listed options!
         Make sure to use the appropriate option (A or B) in the parent pom
        -->
    
        <!-- 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>
          <exclusions>
            <exclusion>
              <groupId>info.magnolia.translation</groupId>
              <artifactId>magnolia-content-translation</artifactId>
            </exclusion>
            <exclusion>
              <groupId>info.magnolia.translation</groupId>
              <artifactId>magnolia-content-translation-pages-integration-app</artifactId>
            </exclusion>
            <exclusion>
              <artifactId>info.magnolia.marketingtags</artifactId>
              <groupId>magnolia-marketing-tags</groupId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <!-- exclude jars copied "physically" from the webapp overlay - so we only get those resolved by Maven's dependency management -->
              <dependentWarExcludes>WEB-INF/lib/*.jar</dependentWarExcludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </project>
    Note

    When excluding a module from a webapp, you must check whether other modules, which are still part of the webapp, do not have runtime dependencies to the module you exclude. At the latest, you can discover any unsatisfied runtime dependency during the startup of your Magnolia webapp. Runtime dependencies are defined in the Magnolia Module descriptors.

...

The skeleton produced by the Maven archetype has several folders which we have not used so far. This concerns especially the src folder in the webapp subdirectory. In the context of this tutorial page it is the custom-eedx-procore-project/custom-eedx-procore-project-webapp/src folder. This folder has the following subfolders:

...

If you leave these subfolders empty, Maven takes the content from the imported webapp, that is the magnolia-enterprisedx-procore-webapp.

Info

The magnolia-enterprisedx-procore-webapp inherits from the magnolia-enterprise-standard-webapp, which inherits from the magnolia-community-webapp.

...

  1. Create the magnolia.properties file in the following folder: custom-eedx-procore-project/custom-eedx-procore-project-webapp/src/main/webapp/WEB-INF/config/default/.
  2. As the file's contents, reuse the version from our git repository for the custom-eedx-procore-project-webapp
  3. Go to the line which sets the magnolia.resources.dir property.

  4. Assign the property a value which fits the requirements of your projects. Example:

    Code Block
    magnolia.resources.dir=/Users/cmeierjohndoe/dev/light-modules

The complete file:

...

...


In the next and final step you build the webapp.

...

First, change into the root directory of your project. Then, run the mvn command with the tasks clean and install:

Code Block
cd custom-eedx-procore-project
mvn clean install

...

You can find the webapp in the custom-eedx-procore-project/custom-eedx-procore-project-webapp/target folder.

(thumbs up) Congratulations. You've built your own custom webapp based on the Magnolia EE Pro DX Core webapp.