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
In the root/parent
pom.xml
add to thepluginManagement/plugins
section:<!-- 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>
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
Alternatively you can use these convenience scripts: