CQ quickstart is a cool technology to ease the setup of CQ installations; although it’s not a perfect tool for server installations, it’s a perfect to developers to re-install a local CQ development environment or for any kind of demo installation.But a out-of-the-box installation is still a out-of-the-box installation, it doesn’t contain hot fixes or any application bundles, it’s just a raw CQ. In this posting of 2010 I described a way how you can leverage the install directory of CRX to deploy packages and how you can package it for distribution. It’s a bit clumsy, as it requires manual work or extra steps to automate it.
In this post I want to show you a way how you can rebuild a CQ quick start installation including extra packages. And on top of that, you can do it as part of your maven build process, which anyone can execute!
The basic idea is to put all artifacts into a maven repository (e.g. Nexus), so we address it via maven. And then use the maven-assembly-plugin to repackage the quick start file.
- Put your CQ quickstart into your maven repository, so you can reference it. The can freely choose the name, for our example let’s use
groupId=com.adobe.aem.quickstart, artifactId=aem-quickstart, version=5.6.1, packaging=zip. For this example you can also just put the file in your local m2 archive:
- Update your pom.xml file and add dependencies to both maven-quickstart-plugin, the aem-quickstart artifact and an additional content package you create during your build (e.g.
- Extend your pom.xml by this definition
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>quickstart-repackage<id> <configuration> <finalname>quickstart-repackaged</finalname> <descriptors> <descriptor>src/assembly/quickstart-repackaged.xml</descriptor> </descriptors> <appendAssemblyId>false</appendAssemblyId> </configuration> <phase>package</phase> <goals> <goal>single</goal> </goals> <execution> <executions> <plugin> </plugins>
The magic lies in the descriptor file, which I placed in src/assembly (which is just as good as any other location …).
- This file src/assembly/quickstart-repackaged.xml can look like this:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2http://maven.apache.org/xsd/assembly-1.1.2.xsd”> <id>bin</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <outputDirectory>/</outputDirectory> <unpack>true</unpack> <includes> <include>com.adobe.aem.quickstart:aem-quickstart</include> <includes> </includes> <dependencySet> <dependencySet> <outputDirectory>/static/install</outputDirectory> <includes> <include>com.yourcompany.cq.contentpackage:your-contentpackage</include> </includes> </dependencySet> </dependencySets
This descriptor tells the plugin to unpack the quickstart file and then add your your-contentpackage to the static/install folder; from this folder CQ also bootstraps packages during the startup. After this file has been added, the file is repackaged as jar file with the name “quickstart-repackaged” (taken from the pom.xml file).
- Invoke maven with the package goal
If you take this route, you’ll have a fantastic way to automatically build your own flavour of quickstart files. Just download the latest version from your Jenkins server, double-click and — voila — you have a full-fledged up-to-date demonstration or testing instance up and running. And as soon as you have all required ingredients on your nexus, everyone can build such quickstart variants, as it only requires a working maven setup.