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.
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!
Solved! Go to Solution.
Views
Replies
Total Likes
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
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
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.
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!
Nice, glad to help
Thanks for the help
Views
Replies
Total Likes
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
Views
Replies
Total Likes