Examples for using the plugin.

Example for content package project

This is an example maven content-package project, which also contains a couple of convenience scripts to upload and download packages: https://github.com/wcm-io/wcm-io-samples/tree/develop/content-packages/sample-content

It relies on a default confugration for the plugin defined in AEM Global Parent.

Install single content package from filesystem

<plugin>
  <groupId>io.wcm.maven.plugins</groupId>
  <artifactId>wcmio-content-package-maven-plugin</artifactId>
  <configuration>
    <serviceURL>http://localhost:4502/crx/packmgr/service</serviceURL>
    <userId>admin</userId>
    <password>admin</password>
    <packageFile>/path/to/content-package.zip</packageFile>
  </configuration>
</plugin>

Command line:

mvn wcmio-content-package:install

Install multiple content packages from maven repository

This usecase is useful to install hotfix and service pack packages to an AEM instance. The hotfixes have to be uploaded to an internal maven repository before, and can than deployed to any instance via maven using their artifact coordinates. Setting force to false ensures that the packages are installed only once, and not on every run.

<plugin>
  <groupId>io.wcm.maven.plugins</groupId>
  <artifactId>wcmio-content-package-maven-plugin</artifactId>
  <configuration>
    <serviceURL>http://localhost:4502/crx/packmgr/service</serviceURL>
    <userId>admin</userId>
    <password>admin</password>
    <!-- Skip upload if hotfix package was already uploaded before -->
    <force>false</force>
    <packageFiles>
      <packageFile>
        <groupId>groupId</groupId>
        <artifactId>artifactId-1</artifactId>
        <version>1.0.0</version>
        <type>zip</type>
      </packageFile>
      <packageFile>
        <groupId>groupId</groupId>
        <artifactId>artifactId-2</artifactId>
        <version>1.0.0</version>
        <type>zip</type>
      </packageFile>
    </packageFiles>
  </configuration>
</plugin>

Command line:

mvn wcmio-content-package:install

Download content package with unpack and excludes

This downloads a content package back to the project from where it was uploaded from (using the Adobe content-package-maven-plugin). After download it is unpacked automatically, some files are excluded (not unpacked) and some properties are removed from the unpacked .content.xml files (to avoid unwanted changes in SCM commits when versioning the unpacked package contents).

<plugin>
  <groupId>io.wcm.maven.plugins</groupId>
  <artifactId>wcmio-content-package-maven-plugin</artifactId>
  <configuration>
    <serviceURL>http://localhost:4502/crx/packmgr/service</serviceURL>
    <userId>admin</userId>
    <password>admin</password>
    <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>cq\:lastModified</exclude>
      <exclude>cq\:lastModifiedBy</exclude>
    </excludeProperties>
  </configuration>
</plugin>

Command line:

mvn -Dvault.unpack=true wcmio-content-package:download

Run from command line without pom.xml context

You can execute the install and download goals also directly from the command line without a pom.xml context. You have to pass all parameters as Java System parameters then as well.

Example for directly installing a package without a pom:

mvn io.wcm.maven.plugins:wcmio-content-package-maven-plugin:2.1.6:install \
    -Dvault.file=mypackage.zip \
    -Dvault.serviceURL=http://localhost:4502/crx/packmgr/service

The full list of available parameters (user property names) can be found in the plugin documentation.

HTTP wire logging

The Content Package Maven Plugin uses Apache HTTP Client 4 under the hood, and its logging is bridged to the Maven Logging System (using SLF4J).

To enable logging HTTP headers, use on the Maven command line:

-Dorg.slf4j.simpleLogger.log.org.apache.http.headers=DEBUG

To enable complete HTTP wire logging (produces lots of logging data!), use:

-Dorg.slf4j.simpleLogger.log.org.apache.http.wire=DEBUG

Composum Browser

If you want to use the plugin with a Sling instance running the Composum Browser, use a different service URL:

<plugin>
  <groupId>io.wcm.maven.plugins</groupId>
  <artifactId>wcmio-content-package-maven-plugin</artifactId>
  <configuration>
    <serviceURL>http://localhost:8080/bin/cpm/</serviceURL>
  </configuration>
</plugin>

Back to top

Version: 2.1.7-SNAPSHOT. Last Published: 2024-11-15.