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:

    <!-- wcm.io Content Package Plugin -->
    <plugin>
      <groupId>io.wcm.maven.plugins</groupId>
      <artifactId>wcmio-content-package-maven-plugin</artifactId>
      <version>2.1.6</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:

    # 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:

Related articles

The content by label feature displays related articles automatically, based on labels you choose. To edit options for this feature, select the placeholder below and tap the pencil icon.

Related issues