Change order of loading mutable contents | Community
Skip to main content
Alberto_Corral
Level 2
February 22, 2024
Solved

Change order of loading mutable contents

  • February 22, 2024
  • 3 replies
  • 2139 views

Hi.

We have a multisite project in AEM like this:

 

<project >

<groupId>com.adobe.aem.project</groupId>

<artifactId>main</artifactId>

<packaging>pom</packaging>

<version>1.0.0-SNAPSHOT</version>

<modules> <module>site1</module>

<module>site2</module>

<module>site3</module>

<module>site4</module>

<module>site5</module>

<module>dispatcher</module>

</modules>

</project>

 

In site1´s repoinit we are executing an operation that must be the first, before other sites execute their own repoinits

 

The problem is that the order is not the same in stage and production environments so our configuration is not been loaded in the right order.

 

Are there any way of priorize or choose the order in the load of this mutable contents?

 

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Thank you for your response.

 

Unfortunatly I am in Cloud Manager and I am not using pPackage Manager at all. So I am afraid I can´t apply the solution you gave me.

 

However I have added the dependency in the general pom of each file and the pipeline takes into  account, so my software is now deploying right


Hi @alberto_corral 
Yes, I meant adding dependency directly from POM not from package manager.

 

Package manager just for UI and manual package build.

3 replies

Level 2
February 22, 2024

Hi @alberto_corral  - Refer section 'Reactor Sorting' on this page - https://maven.apache.org/guides/mini/guide-multiple-modules.html

 

As explained, you need to define the dependency of site2, site3, site4, site5 modules on site1 module to let site1 module run first. Define your pom.xml of the respective module accordingly. Try something like below with Maven Invoker Plugin. 

 

<project>
<groupId>com.adobe.aem.project</groupId>
<artifactId>main</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>

<modules>
<module>site1</module>
<module>site2</module>
<module>site3</module>
<module>site4</module>
<module>site5</module>
<module>dispatcher</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<projectsDirectory>site1</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/invoker</cloneProjectsTo>
<pomIncludes>
<pomInclude>site1/pom.xml</pomInclude>
</pomIncludes>
</configuration>
<executions>
<execution>
<id>run-site1</id>
<goals>
<goal>run</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Alberto_Corral
Level 2
February 22, 2024

Hi. Thank you for your response.

 

The reactor order is right. We don´t have the problem in building step. Our problem is in deployment step, that is, when AEM is loading the contents generated in the previous step. As I can see in the deploy_step.log 

 

[main] CONTAINER_STATUS 0
'/mnt/exchange/extract/fm.out/mutable-content-packages.csv' -> '/mnt/sandbox/packages.csv'
'/mnt/exchange/extract/mutable-content' -> '/mnt/sandbox/extract'
'/mnt/exchange/extract/mutable-content/com/package' -> '/mnt/sandbox/extract/com/package'
'/mnt/exchange/extract/mutable-content/com/package' -> '/mnt/sandbox/extract/com/package'
'/mnt/exchange/extract/mutable-content/com/package/site4' -> '/mnt/sandbox/extract/com/package/site4'
'/mnt/exchange/extract/mutable-content/com/package/site4/site4.ui.content' -> '/mnt/sandbox/extract/com/package/site4/site4.ui.content'

....

....

....

 

As you can see in this log site4 is the first in being installed in the deploy step, but I need site1 be the first.

 

Thanks in advance.

arunpatidar
Community Advisor
Community Advisor
February 22, 2024
Alberto_Corral
Level 2
February 22, 2024

Hi. Thank you for your response. As I said in my last answer is not a problem with compile/build phase. The problem is when Adobe builts the image in the deployment phase. In this phase all packages are built (content, apps, config, core ....) and is here where I need to choose the order of loading.

 

Thanks in advance

Alberto_Corral
Level 2
February 23, 2024

Please take an example of core component where your project is depends on core component and core components installed first in AEM.

with Maven it is possible to handle the build sequence of any module or project, to manage the sequence for AEM installed, you need to add dependencies of site1 into other projects.

https://experienceleague.adobe.com/docs/experience-manager-65/content/sites/administering/contentmanagement/package-manager.html?lang=en#dependencies 


Thank you for your response.

 

Unfortunatly I am in Cloud Manager and I am not using pPackage Manager at all. So I am afraid I can´t apply the solution you gave me.

 

However I have added the dependency in the general pom of each file and the pipeline takes into  account, so my software is now deploying right

aanchal-sikka
Community Advisor
Community Advisor
February 25, 2024

@alberto_corral 

 

As @arunpatidar suggested, this can be dealt via dependencies. 

You just need to declare dependency of "site-1 repo-init module" in the "repo-init module of other projects".

 

This assures that site-1 is installed before site-2 

Aanchal Sikka