Dependencies needed to inject Content Aware Configuration annotation @ContextAwareConfiguration | Community
Skip to main content
narendiran_ravi
Level 6
August 1, 2024
Solved

Dependencies needed to inject Content Aware Configuration annotation @ContextAwareConfiguration

  • August 1, 2024
  • 2 replies
  • 1068 views

I am trying to use @ContextAwareConfiguration to inject CA config into Sling models. This annotation is not resolved even after adding the dependency in my core pom.xml

<dependency>
    <groupId>org.apache.sling</groupId>
    <artifactId>org.apache.sling.models.caconfig</artifactId>
    <version>1.0.2</version>
</dependency>

It would be helpful if someone could share the correct dependency details

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 MukeshYadav_

myproj.core:1.0.0-SNAPSHOT is importing package(s) org.apache.sling.models.caconfig.annotations in start level 20 but no bundle is exporting these for that start level. (com.test:myproj.all:1.0.0-SNAPSHOT)  - Compilation issue is resolved in core module, but getting this error in all module 


Hi

Pls try https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/getting-error-while-building-maven-project-quot-bundle-aem/m-p/433445

Thanks

2 replies

MukeshYadav_
Community Advisor
Community Advisor
August 1, 2024

Hi @narendiran_ravi ,

As per doc https://sling.apache.org/documentation/bundles/models.html

It is available from 1.0.0 and I am able to resolve in both

can you explicitly import  in your code

import org.apache.sling.models.caconfig.annotations.ContextAwareConfiguration;

 

Thanks

 

narendiran_ravi
Level 6
August 1, 2024

Thanks @mukeshyadav_  for the reply. I tried to add the import directly in the model file but it is not resolved. I am not sure what I am missing.

 

 

Under which pom.xml file you have included the dependency and what is the dependency you have added? Could you please share your pom.xml if possible? 

narendiran_ravi
Level 6
August 1, 2024

myproj.core:1.0.0-SNAPSHOT is importing package(s) org.apache.sling.models.caconfig.annotations in start level 20 but no bundle is exporting these for that start level. (com.test:myproj.all:1.0.0-SNAPSHOT)  - Compilation issue is resolved in core module, but getting this error in all module 

narendiran_ravi
Level 6
August 1, 2024

After embedding the dependency in all pom it is working. This bundle is not provided by AEM SDK. So we need to explicitly embed in all pom so that it will be included in the build.