Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Unable to see the CA Config in Configuration Editor

Avatar

Level 2

We have added wcm-io package to our instance and to the project as a dependency. We have also created a template inside our project under /apps/myproject/templates/ca-config-page with the following jcr:content node:

{"jcr:primaryType":"cq:PageContent","jcr:createdBy":"admin","jcr:created":"Tue Jan 03 2023 17:18:25 GMT-0800","sling:resourceType":"wcm-io/caconfig/editor/components/page/editor"}

I created a CA config in the codebase using the @Configuration annotation. Following is the configuration:

package com.myproject.core.caconfig;

import org.apache.sling.caconfig.annotation.Configuration;
import org.apache.sling.caconfig.annotation.Property;

@Configuration(label = "Test configuration", description = "TEst configuration")
public @interface Events {
/**
* @return some value
*/
@Property(label = "Some value", description = "Some Value", order = 1)
String someValue();

}

I created a CA-config page under content/myproject.

99spanchal_2-1686678521357.png

 

However, it does not show the CA-config that I created when I click on the Add button.  What am I missing here?  

 

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Are you using the bnd-maven-plugin? If so, there is a known issue where the context aware configurations are created as java interface, the bnd-maven-plugin is not able to scan the class, hence no context aware configurations are detected.

 

Fix

Add multiple plugins as comma-separated values i.e. https://bnd.bndtools.org/instructions/plugin.html
example
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin,org.apache.sling.bnd.models.ModelsScannerPlugin

 

Source: https://github.com/adobe/aem-project-archetype/issues/975

 



Esteban Bustamante

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

Are you using the bnd-maven-plugin? If so, there is a known issue where the context aware configurations are created as java interface, the bnd-maven-plugin is not able to scan the class, hence no context aware configurations are detected.

 

Fix

Add multiple plugins as comma-separated values i.e. https://bnd.bndtools.org/instructions/plugin.html
example
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin,org.apache.sling.bnd.models.ModelsScannerPlugin

 

Source: https://github.com/adobe/aem-project-archetype/issues/975

 



Esteban Bustamante

Avatar

Level 2

Hi @EstebanBustamante,

 

Thanks for you reply!

I dont think thats the issue, I am able to see CA-configs from other projects available in the instance but not the ones that are created inside myproject codebase. To test this, I created a ca-config inside one of the other projects and I was able to see the configuration inside /content/myproject/ca-config. 

Moreover, when I am adding the configuration to /conf/myprojects/sling:configs manually(that is, from crx/de), my codebase is able to read the configuration and execute the functionalities as expected.

Avatar

Level 1

Hey @EstebanBustamante! I know what you mean now! And it worked. I forgot to check this one but mine was not seperated by comma. I made that change and it worked: 

Bundle-DocURL:
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin, org.apache.sling.bnd.models.ModelsScannerPlugin

 

Thanks again for helping!

Avatar

Community Advisor

For anyone facing the same issue , as @EstebanBustamante mentioned , you need to add your CA class values in the pom.xml. You can add it as Sling-ContextAware-Configuration-Classes: in the CDATA section of <bnd> tag like below

 

VeenaVikraman_0-1705959033933.png