How to use wcm.io Content Package Plugin in Adobe AEM Archetype Project

wcm.io provides a Content Package Maven Plugin that supports uploading and downloading content from AEM content package to a local AEM instance. This is very useful when preparing content packages locally in a Git repository with sample content or editable template definitions.

When downloading the content package, it extracts the XML files and cleans them up, removing any properties which like last modified timestamps which do not need to be part of the Git repository.

This page describes how to configure the plugin in an AEM projects that was set up with the Adobe AEM Project Archetype.

Instructions

  1. In the root/parent pom.xml add to the pluginManagement/plugins section:

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 <!-- wcm.io Content Package Plugin --> <plugin> <groupId>io.wcm.maven.plugins</groupId> <artifactId>wcmio-content-package-maven-plugin</artifactId> <version>1.8.4</version> <configuration> <serviceURL>http://${aem.host}:${aem.port}/crx/packmgr/service</serviceURL> <userId>${sling.vault.user}</userId> <password>${sling.vault.password}</password> <consoleUserId>${sling.console.user}</consoleUserId> <consolePassword>${sling.console.password}</consolePassword> <excludeFiles> <exclude>^META-INF/.*</exclude> <!-- exclude renditions that are automatically generated --> <exclude>.*/cq5dam\.thumbnail\..*</exclude> </excludeFiles> <excludeProperties> <exclude>jcr\:created</exclude> <exclude>jcr\:createdBy</exclude> <exclude>jcr\:lastModified</exclude> <exclude>jcr\:lastModifiedBy</exclude> <exclude>jcr\:uuid</exclude> <exclude>jcr\:isCheckedOut</exclude> <exclude>cq\:lastModified</exclude> <exclude>cq\:lastModifiedBy</exclude> <exclude>cq\:lastReplicated</exclude> <exclude>cq\:lastReplicatedBy</exclude> <exclude>cq\:lastReplicationAction</exclude> <exclude>cq\:lastRolledout</exclude> <exclude>cq\:lastRolledoutBy</exclude> <exclude>dam\:extracted</exclude> <exclude>dam\:sha1</exclude> <exclude>dam\:Comments</exclude> <exclude>dam\:assetState</exclude> <exclude>dam\:relativePath</exclude> <exclude>dc\:modified</exclude> </excludeProperties> <excludeMixins> <exclude>mix\:versionable</exclude> <exclude>mix\:referenceable</exclude> <exclude>cq\:Taggable</exclude> <exclude>cq\:ReplicationStatus</exclude> </excludeMixins> <unpackDirectory>src/main/content</unpackDirectory> <unpackDeleteDirectories> <directory>jcr_root</directory> </unpackDeleteDirectories> <failOnMissingEmbed>true</failOnMissingEmbed> </configuration> </plugin>
  2. In the folder of the content package project (e.g. ui.content) use the following commands to upload/download the content:

    1 2 3 4 5 # Upload content mvn clean package wcmio-content-package:install # Download & unpack content mvn package -Dvault.unpack=true wcmio-content-package:download
  3. Alternatively you can use these convenience scripts: