Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Replace io.wcm.samples.* with the topmost package from your project.

Step 6: Check for usage of build-helper-maven-plugin with add-resources goal

In wcm.io-based projects it was usual to apply special resource filtering to JSON files describing AEM client libraries to replace the “long cache key” with the current bundle version and SCM build number at build time. Usage example:

Code Block
languagexml
<!-- Apply maven filtering to clientlib definitions (cache key) -->
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>add-resource</goal>
      </goals>
      <phase>process-resources</phase>
      <configuration>
        <resources>
          <resource>
            <directory>src/main/webapp</directory>
            <targetPath>SLING-INF</targetPath>
            <filtering>true</filtering>
            <includes>
              <include>clientlibs-root/*.json</include>
            </includes>
          </resource>
        </resources>
      </configuration>
    </execution>
  </executions>
</plugin>

You have to remove this definition completely and replace it with a “resources” definition in the “build” section - example:

Code Block
languagexml
<resources>
  <!-- copy webapp resources to SLING-INF/app-root -->
  <resource>
    <directory>src/main/webapp</directory>
    <targetPath>SLING-INF</targetPath>
    <filtering>false</filtering>
  </resource>
  <!-- Apply maven filtering to clientlib definitions (cache key) -->
  <resource>
    <directory>src/main/webapp</directory>
    <targetPath>SLING-INF</targetPath>
    <filtering>true</filtering>
    <includes>
      <include>clientlibs-root/*.json</include>
    </includes>
  </resource>
</resources>

Unfortunately you have to copy the existing resource definitions from the aem-global-parent POM that are relevant for your module as they are not inherited/merged by Maven automatically.

Step 7: Check for optional dependencies

Watch out for maven dependencies in your POM that are declared as “optional”. The maven-bundle-plugin marked the package imports for those automatically as “resolution=optional” - this is not the case, you have to list mark packages yourself - example:

Code Block
languagexml
Import-Package: \
  <!-- optional dependency -->\
  io.wcm.sling.commons.caservice;resolution:=optional,\
  *

Optional Steps

Embedding JARs/Classes in the bundle

...