handle-multiple-projects-with-cloud-manager.jpg
Handle Multiple Projects With Cloud Manager
Mar 15th, 2021 | Varshish Bhanushali

Adobe Cloud Manager comes provisioned with a single git repository that is used to deploy code using Cloud Manager’s CI/CD pipelines. If your code is split across multiple repositories which is often the case in larger Adobe Experience Manager Implementations, you will need to consolidate multiple git repositories into a single git repository.

In this article, I will walk through steps to consolidate multiple tenants/git repositories containing your Adobe Experience Manager multi-module projects into a single repository and sync that with the Cloud Manager git repository.

In this walkthrough I will execute the following steps at a high level:

  1. Generate a new Project A using the Adobe Experience Manager project archetyp
  2. Re-organize project A for consolidation and Commit project A to git
  3. Generate a new Project B using the Adobe Experience Manager project archetype
  4. Re-organize project B for consolidation Commit project B to git
  5. Merge project B/master into project A/master


  6. Step 1 : Generate a new Project A using the Adobe Experience Manager project archetype

    In this step, we will create a new Adobe Experience Manager project as project A using the Adobe Experience Manager archetype. The project structure is as per the below screenshot:


    code1.jpg

    Step 2 : Re-organize project A for consolidation

    1. Navigate to the project A using command line tool.
    2. Create new folder.
      mkdir project-A
      
    3. Now move all the modules except the dispatcher module inside project-A folder.
      git mv all  analyse  core  it.test  ui.apps.structure  ui.apps  ui.config  ui.frontend  ui.test pom.xml project-A
      
    4. Create a new pom.xml file outside project-A folder and update with following content
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
              <modelVersion>4.0.0</modelVersion>
              <groupId>com.consolidated</groupId>
              <artifactId>consolidated-aem-project</artifactId>
              <packaging>pom</packaging>
              <version>1.0.0-SNAPSHOT</version>
              <description>consolidated-aem-project</description>
              <modules>
                  <module>dispatcher</module>
                  <module>project-A</module>
              </modules>
      </project>
      
    5. Also update the dispatcher’s module pom.xml such that the newly created pom.xml is a parent of the dispatcher module.
    6. Test the project by running
      mvn clean install
      
      
    7. Commit and push the changes to git. The resulting project structure should look like below. code2.jpg


    Step 3 : Generate a new Project B using the Adobe Experience Manager project archetype

    In this step, we will create a new Adobe Experience Manager project as project B using the Adobe Experience Manager archetype as shown below.


    code3.jpg

    Step 4 : Re-organize project B for consolidation

    1. Navigate to the project B using command line tool
    2. Create new folder
      mkdir project-B
      
    3. Now move all the modules except the dispatcher module inside the project-B folder.
      git mv all  analyse  core  it.test  ui.apps.structure  ui.apps  ui.config  ui.frontend  ui.test pom.xml project-B
      
    4. Delete dispatcher module as we are going to merge this with project A and over there we have a dispatcher module.
    5. Test the project by running
      mvn clean install
      
    6. Commit and push the changes to git. The resulting project structure will look like below. code4.jpg
    code5.jpg

    Step 5 : Merge project B/master into project A/master

    In this step, we are going to merge the two projects and are going to consolidate them into one. This consolidated repo is then used as a cloud manager repo so the cloud manager pipeline will able to build both the projects.

    1. Navigate to the project A and add project-b as GitHub remote repository for project B
      git remote add project-b ../project-b
      
    2. Now fetch the project B
      git fetch project-b --no-tags
      
    3. Merge the project B and final consolidated project looks like below
      git merge project-b/master --allow-unrelated-histories
      
      code6.jpg
    4. After a successful merge, we need to modify the root pom.xml such that it points to project-A and project-B projects
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
              <groupId>com.consolidated</groupId>
              <artifactId>consolidated-aem-project</artifactId>
              <packaging>pom</packaging>
              <version>1.0.0-SNAPSHOT</version>
              <description>consolidated-aem-project</description>
              <modules>
                  <module>dispatcher</module>
                  <module>project-A</module>
                  <module>project-B</module>
              </modules>
      </project>
      
    5. Verify the build
      mvn clean install
      
    6. Remove the project-b remote
      git remote remove project-b
      
    7. Commit and push the changes to project-A

    Project-A will be your new consolidated git repo which can be sync’d with cloud manager GIT and deployed by the pipeline.

    Are you handling multiple projects with Cloud Manager? How has it turned out for you until now? If you are considering Cloud Manager to handle multiple projects and in need of help to get it done, contact us today

Get notified on our latest insights

Subscribe to our periodic summaries of the latest in tech news and innovation. Get up-to-date articles with our take and insights on the ever-changing digital landscape.

Related Posts
Trending Posts

Subscribe to our Insights

Subscribe to our periodic summaries of the latest in tech news and innovation. Get up-to-date articles with our take and insights on the ever-changing digital landscape.