Install CRISP Addon as Shared Module

Introduction

In some use cases, you might want to keep the single set of CRISP ResourceResolver configurations in the CMS (or "Platform") web application. This shared module deployment model allows all web applications to use the same shared ResourceResolvers without having to configure them separately. This page explains how to install CRISP Addon in the shared module deployment model.

Steps to Install CRISP Addon As Shared Module

Option to Share ResourceServiceBroker in HST-2 Container Configuration

In the HST-2 Container Configuration file, such as ${catalina.base}/conf/hst.properties, or cms/src/main/webapp/WEB-INF/hst-config.properties, add the following property to register the ResourceServiceBroker component as a shared service.

# ...
# Enable option to register the shared ResourceServiceBroker to HippoServiceRegistry
crisp.broker.registerService = true
# ...

In the shared module deployment model, the ResourceServiceBroker component is initialized and shared by the CMS (or "Platform") web application, so all web applications can access the shared component through CrispHstServices.getDefaultResourceServiceBroker(HstServices.getComponentManager()) transparently.

Jackson Annotation and CRISP API as provided Dependencies

Two JAR dependencies must be shared between web applications. One is Jackson Annotation (com.fasterxml.jackson.core:jackson-annotations) JAR dependency and the other is CRISP API (org.onehippo.cms7:hippo-addon-crisp-api) JAR dependency.

Add the two dependencies as provided scope in the root pom.xml.

  <dependencyManagement>

    <dependencies>

      <!-- SNIP -->

      <!-- Add these as provided with version numbers in dependencyManagement/dependencies. -->

      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${jackson2.version}</version>
        <scope>provided</scope>
      </dependency>

      <dependency>
        <groupId>org.onehippo.cms7</groupId>
        <artifactId>hippo-addon-crisp-api</artifactId>
        <version>${hippo.addon-crisp.version}</version>
        <scope>provided</scope>
      </dependency>

      <!-- SNIP -->

    </dependencies>

  </dependencyManagement>

  <dependencies>

    <!-- SNIP -->

    <!-- Add these as provided in dependencies; no need to add these in cargo.run and dist profiles again. -->

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-addon-crisp-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- SNIP -->

  </dependencies>

The cargo.run profile

The two shared JAR dependencies must be configured to be deployed onto the shared classpath in the cargo.run profile, so you can provide those shared JAR files through the Tomcat container when running with mvn -Pcargo.run.

Add the two dependencies in the cargo container configuration with shared classpath settings like the following:

    <profile>
      <id>cargo.run</id>
      <dependencies>
        <!-- SNIP -->
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <configuration>
                <!-- SNIP -->
              </configuration>
              <deployables>
                <!-- SNIP -->
              </deployables>
              <container>
                <systemProperties>
                  <!-- SNIP -->
                </systemProperties>
                <dependencies>
                  <!-- SNIP -->
                  <dependency>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-annotations</artifactId>
                    <classpath>shared</classpath>
                  </dependency>
                  <dependency>
                    <groupId>org.onehippo.cms7</groupId>
                    <artifactId>hippo-addon-crisp-api</artifactId>
                    <classpath>shared</classpath>
                  </dependency>
                  <!-- SNIP -->
                </dependencies>
              </container>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

The dist profile

The two shared JAR dependencies must be packaged into the shared classpath (i.e. shared/lib) when creating a tar.gz file through the dist profile.

Add the two dependencies in the src/main/assembly/shared-lib-component.xml like the following:

<component xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd">
  <dependencySets>
    <dependencySet>
      <useProjectArtifact>false</useProjectArtifact>
      <outputDirectory>shared/lib</outputDirectory>
      <scope>provided</scope>
      <includes>
        <!-- SNIP -->
        <include>com.fasterxml.jackson.core:jackson-annotations</include>
        <include>org.onehippo.cms7:hippo-addon-crisp-api</include>
        <!-- SNIP -->
      </includes>
    </dependencySet>
  </dependencySets>
</component>

Dependencies in CMS (or "Platform") Web Application

Add the following dependencies in the cms-dependencies/pom.xml:

  <dependencies>
 
    <!-- SNIP -->
 
    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-addon-crisp-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-addon-crisp-core</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-addon-crisp-hst</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-addon-crisp-repository</artifactId>
      <scope>runtime</scope>
    </dependency>
 
    <!-- SNIP -->
 
  </dependencies>

Dependencies in Content Delivery Web Application(s)

Add the following dependency in the site/components/pom.xml:

  <dependencies>
 
    <!-- SNIP -->
 
    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-addon-crisp-api</artifactId>
      <scope>provided</scope>
    </dependency>
  
    <!-- SNIP -->
 
  </dependencies>

Now, you're ready to go!

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?