Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Osgiconfig precedence for same pid with submodules and parent

Avatar

Employee

Hi Team,

In AEMaaCS We have git submodules to our main parent repo and have only read access to submodules.
There is one Osgiconfig called "com.day.cq.commons.impl.ExternalizerImpl.cfg" in both submodules as well as parent repo.
Then given module order in main pom.xml as below

:<module>parent all<module>
<module>parent core<module>
<module>parent ui.config<module>
<module>submodule<module>


Now the issue seems to be submodule osgiconfig always takes precendencein publish  but we need our main parent osgiconfig value to be populated. In both repo, Osgiconfig is present in config.publish folder

 

please help what we need to do in this case.

 

 

@aanchal_sikka @arunpatidar 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Yes, config.publish.dev folder should take precedences and populate parent config values.

View solution in original post

6 Replies

Avatar

Community Advisor

@Amsalek4  You can not have the same name for the OSGi in submodules and parent modules, try below solution 

 

com.day.cq.commons.impl.ExternalizerImpl.cfg~submodule1.cfg.json

com.day.cq.commons.impl.ExternalizerImpl.cfg~sumodule2.cfg.json

com.day.cq.commons.impl.ExternalizerImpl.cfg~parentmodule.cfg.json

Avatar

Employee

Hi @Jagadeesh_Prakash 

I tried this. its not working. I hope this (com.day.cq.commons.impl.ExternalizerImpl.cfg~parentmodule.cfg.jsonis for osgi factory configs right where we can create multiple configs for each scenario. but when we don't have option to create multiple in ootb config example AEMEnvironmentalindicator, ExternalizerImpl.

Avatar

Community Advisor

If you did not check this answer by @arunpatidar, deeper paths (submodule) in the repository takes higher precedence. As OSGI configuration that has the most matching run modes is used, yow can update your parent osgiconfig folder like config.[environment].publish.

Order of Precedence:

  • Configuration settings are applied based on an order of precedence. The settings in the /apps directory take precedence over /libs settings.
  • Run mode-specific settings take precedence over common settings.
  • If there are multiple configurations under the same run mode, the order of the paths in the repository matters.
  • Configurations at deeper paths in the repository structure take precedence.

Avatar

Employee

@Mahedi_Sabuj 

Thanks, In our case, how to populate our parent config values? do we need to change the folder name.?

current one : config.publish. if changing folder name to config.publish.dev would work?

Avatar

Correct answer by
Community Advisor

Yes, config.publish.dev folder should take precedences and populate parent config values.

Avatar

Employee Advisor

The Externalizer is not a factory service, that means there is just 1 configuration active. If you have 2 configurations in your repo, one will be active (either predictable or not), but that's probably not what you want.

First, you need to define what the actual value should be, and as next step you need to define, where you want to maintain it. Because if every team can decide on its own, what OSGI configuration they want and expect, you will likely end up with many problems.