Install CRISP Addon as Shared Module
Introduction
In some use cases, you might want to keep the single set of CRISPResourceResolver configurations in the CMS (or "Platform") web application. This shared module deployment model allows all web applications to use the same sharedResourceResolvers 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 theHST-2 Container Configuration file, such as${catalina.base}/conf/hst.properties, orcms/src/main/webapp/WEB-INF/hst-config.properties, add the following property to register theResourceServiceBroker component as a shared service.
# ...# Enable option to register the shared ResourceServiceBroker to HippoServiceRegistrycrisp.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 throughCrispHstServices.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 asprovided scope in the rootpom.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 theshared classpath in thecargo.run profile, so you canprovide those shared JAR files through the Tomcat container when running withmvn -Pcargo.run.
Add the two dependencies in the cargo container configuration withshared classpath settings like the following:
<profile> <id>cargo.run</id> <dependencies> <!-- SNIP --> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven3-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 theshared classpath (i.e.shared/lib) when creating a tar.gz file through thedist profile.
Add the two dependencies in thesrc/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 thecms-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 thesite/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!