AEM sub projects - modular projects


Use Case: Let's say you have "Project-Proton" , "Project-Electron" both use some reusable components, templates from "Project-Atom".


Instructions to deploy a "Project-Atom" to an AEM instance as part of other project ("Project-Proton", "Project-Electron").

PRE REQUISITE:

Local .m2 repository or Internal nexus central repository has "Project-Atom" artifact available in nexus repository. Have the Internal nexus central repository as repository in "Project-Proton".

"Project-Atom" aem project provides reusable templates, pages, components, branding across Corporate aem projects.

Following are the changes required for any project that would like to use "Project-Atom" features.

There are two approaches to do this.
Please implement the following changes in "Project-Proton" or "Project-Electron"

APPROACH 1:

Bundle POM
Please have the following dependency in bundle pom.

         <dependency>
            <groupId>com.corporate</groupId>
            <artifactId>atom.core</artifactId>
        </dependency>

UI.APPS POM
Please have the subpackage "component-marketplace.ui.apps" as part of below plugin in ui.apps pom

Example:
            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <filterSource>${basedir}/META-INF/vault/filter.xml</filterSource>
                    <verbose>true</verbose>
                    <failOnError>true</failOnError>
                    <group>corporate-global</group>
                    <!-- Adding timeout to give AEM enough time to remove the old package and install the new one-->
                    <timeout>30</timeout>
                    <embeddeds>
                        <embedded>
                            <groupId>com.corporate</groupId>
                            <artifactId>proton-global.core</artifactId>
                            <target>/apps/proton/install</target>
                        </embedded>
                    </embeddeds>
                    <subPackages>
                        <subPackage>
                            <groupId>com.adobe.acs</groupId>
                            <artifactId>acs-aem-commons-content</artifactId>
                            <filter>true</filter>
                        </subPackage>
                        <subPackage>
                            <groupId>com.corporate</groupId>
                            <artifactId>atom.ui.apps</artifactId>
                            <filter>true</filter>
                        </subPackage>
                    </subPackages>
                </configuration>
            </plugin>

 Please have the following dependency in ui.apps pom.
        <dependency>
            <groupId>com.corporate</groupId>
            <artifactId>atom.ui.apps</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>content-package</type>
        </dependency>



UI.APPS - FILTER.XML
Please add following line in ui.apps filter.xml which is located in META-INF folder

<filter root="/etc/packages/atom"/>



APPROACH 2:

Bundle POM
Please have the following dependency in bundle pom.

         <dependency>
            <groupId>com.corporate</groupId>
            <artifactId>atom.core</artifactId>
        </dependency>

UI.APPS POM
Please have install-cmp execution as part of "content-package-maven" plugin configuration in ui.apps pom

You would like to have this configuration in both autoInstallPackage, autoInstallPackagePublish profiles to deploy the component-marketplace.ui.apps package to author, publish instances

Example:
        <profile>
            <id>autoInstallPackage</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-package</id>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                            </execution>
                        <execution>
                            <id>install-cmp</id>
                            <configuration>
                                <groupId>com.corporate</groupId>
                                <artifactId>atom.ui.apps</artifactId>
                                <packaging>zip</packaging>
                                <version>1.0-SNAPSHOT</version>
                            </configuration>  
                            <goals>
                                <goal>install</goal>
                            </goals>
                        </execution>
               
                        </executions>
                        <configuration>
                                     <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>
                            <failOnError>true</failOnError>
                            <failOnMissingEmbed>true</failOnMissingEmbed>
                        </configuration>
                     </plugin>
                 </plugins>
            </build>
        </profile>

UI.APPS POM

Please have the following dependency in ui.apps pom.
        <dependency>
            <groupId>com.corporate</groupId>
            <artifactId>atom.ui.apps</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>content-package</type>
        </dependency>



Comments