Setup ACS AEM Commons in AEM Projects

Published
ACS AEM Commons is a collection of reusable components and utilities designed to enhance the functionality of AEM. It offers a variety of features that help developers tackle common challenges and simplify development tasks through effective solutions.
ACS AEM Commons should be included as a Maven dependency in your AEM project. The instructions for adding ACS AEM Commons to your project vary depending on the version of AEM you are using.
The setup for ACS AEM Commons in your code base differs slightly between AEMaaCS and AEM 6.5.

AEM as a Cloud Service

To include ACS AEM Commons in AEMaaCS, embed acs-aem-commons-all and add it as a dependency in the container package (all module) pom.xml as shown below.
all / pom.xml
<plugins> <plugin> <groupId>org.apache.jackrabbit</groupId> <artifactId>filevault-package-maven-plugin</artifactId> <configuration> <embeddeds> <embedded> <groupId>com.adobe.acs</groupId> <artifactId>acs-aem-commons-all</artifactId> <target>/apps/aem-demo-vendor-packages/container/install</target> <filter>true</filter> <isAllVersionsFilter>true</isAllVersionsFilter> </embedded> </embeddeds> </configuration> </plugin> </plugins> <dependencies> <dependency> <groupId>com.adobe.acs</groupId> <artifactId>acs-aem-commons-all</artifactId> <classifier>cloud</classifier> <version>6.6.4</version> <type>zip</type> </dependency> </dependencies>
After installing the code, ACS AEM Commons will appear in the Tools section, as shown below.
ACS Commons in AEMaaCS
To use Java APIs provided by ACS AEM Commons in your code, add acs-aem-commons-bundle dependency in your core module.
core / pom.xml
<dependency> <groupId>com.adobe.acs</groupId> <artifactId>acs-aem-commons-bundle</artifactId> <version>6.6.4</version> <scope>provided</scope> </dependency>

AEM 6.5

All information of AEM as a Cloud Service above applies, but instead of using the specific classifier cloud, you don't use any classifier at all. Also instead of embeddeds one leverages subpackages.
all / pom.xml
<plugins> <plugin> <groupId>org.apache.jackrabbit</groupId> <artifactId>filevault-package-maven-plugin</artifactId> <configuration> <subPackages> <subPackage> <groupId>com.adobe.acs</groupId> <artifactId>acs-aem-commons-all</artifactId> <filter>true</filter> <isAllVersionsFilter>true</isAllVersionsFilter> </subPackage> </subPackages> </configuration> </plugin> </plugins> <dependencies> <dependency> <groupId>com.adobe.acs</groupId> <artifactId>acs-aem-commons-all</artifactId> <version>6.6.4</version> <type>zip</type> </dependency> </dependencies>

References