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.
Required Steps:
- Put your CQ quickstart into your maven repository, so you can reference it. They 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: ~/m2/repository/com/adobe/aem/quickstart/aem-quickstart/5.6.1/aem-quickstart-5.6.1.zip
- 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. com.yourcompany.cq5.contentpackage:your-content package).
- 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>
- 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>
- Invoke maven with the package goal
No comments:
Post a Comment
If you have any doubts or questions, please let us know.