Migrate from wcm.io Maven aem-global-parent 1.1.x to 1.2.x

Problem

When you migration you project from the parent pom io.wcm.maven:io.wcm.maven.aem-global-parent from version 1.1.x to 1.2.x you have to do some adjustments to your project.

The default definition of Adobe's content-package-maven-plugin has changed to allow switching to wcmio-content-package-maven-plugin for building content packages.

When you update your parent pom Dependency your project build will fail with an error message like this:

$ mvn clean install
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: content-package @ line 35, column 14
[ERROR] Unknown packaging: content-package @ line 36, column 14
 @
[ERROR] The build could not read 2 projects -> [Help 1]
[ERROR]
[ERROR]   The project io.wcm.samples:io.wcm.samples.complete:1.1.1-SNAPSHOT (wcm-io\wcm-io-samples\complete\pom.xml) has 1 error
[ERROR]     Unknown packaging: content-package @ line 35, column 14
[ERROR]
[ERROR]   The project io.wcm.samples:io.wcm.samples.sample-content:1.1.1-SNAPSHOT (wcm-io\wcm-io-samples\sample-content\pom.xml) has 1 error
[ERROR]     Unknown packaging: content-package @ line 36, column 14
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

Solution

You have two alternative solutions:

  • a) Stick with Adobe content-package-maven-plugin and add the missing configuration
  • b) Switch to Jackrabbit filevault-package-maven-plugin (recommended)
  • c) Switch to wcmio-content-package-maven-plugin

Solution a) Stick with Adobe content-package-maven-plugin

  • Edit all pom.xml with packaging type content-package
  • Add

    <extensions>true</extensions>

    to the plugin definition of com.day.jcr.vault:content-package-maven-plugin

Solution b) Switch to Jackrabbit filevault-package-maven-plugin (recommended)

You need to update to aem-global-parent 1.2.10 or higher for this solution.
  • Edit all pom.xml with packaging type content-package
  • Switch plugin definition from com.day.jcr.vault:content-package-maven-plugin to org.apache.jackrabbit:filevault-package-maven-plugin
  • Add

    <extensions>true</extensions>

    to the plugin definition of org.apache.jackrabbit:filevault-package-maven-plugin

Solution c) Switch to wcmio-content-package-maven-plugin

  • Edit all pom.xml with packaging type content-package
  • Switch plugin definition from com.day.jcr.vault:content-package-maven-plugin to io.wcm.maven.plugins:wcmio-content-package-maven-plugin
  • Add

    <extensions>true</extensions>

    to the plugin definition of io.wcm.maven.plugins:wcmio-content-package-maven-plugin

  • Add a resource definition to copy the content of your jcr_root folder to the target/classes folder like this:

    <resources>
      <!-- Include all files from jcr_root in content package -->
      <resource>
        <directory>jcr_root</directory>
      </resource>
    </resources>
  • If your project does not contain a jcr_content folder, but only OSGi bundles copied via maven-dependency-plugin to the vault-work folder you can omit the previous step ("complete" package)

Sample projects: