I am trying to setup my env for unit test for sling models for AEM 6.3
there is one error I see when running maven build
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 1.165 sec <<< FAILURE! - in com.mcmc.aem.models.impl.BreadcrumbImplTest
testStyleBasedBreadcrumb(org.cshs.aem.models.impl.BreadcrumbImplTest) Time elapsed: 0.995 sec <<< ERROR!
java.lang.RuntimeException: After setup failed (com.adobe.cq.wcm.core.components.context.CoreComponentTestContext$$Lambda$1/1468177767@72cf2de5): No OSGi SCR metadata found for class com.adobe.cq.wcm.core.components.testing.MockAdapterFactory
at org.apache.sling.testing.mock.osgi.context.ContextPlugins.executeAfterSetUpCallback(ContextPlugins.java:210)
I have been following the project from
GitHub - Adobe-Marketing-Cloud/aem-core-wcm-components: AEM Core WCM Components
I have build plugins and configurations same as aem-core-wcm-components/pom.xml at master · Adobe-Marketing-Cloud/aem-core-wcm-components · GitHub
that should take care of metadata
Not sure why this error is coming
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
We have Adobe HELPX Article on this core components which also includes Sling Models: Developing your first Experience Manager 6.3 Components
Please try this article!
~Ratna.
Views
Replies
Total Likes
Hi,
We have Adobe HELPX Article on this core components which also includes Sling Models: Developing your first Experience Manager 6.3 Components
Please try this article!
~Ratna.
Views
Replies
Total Likes
Hi Shajiahmed,
Could you please change the maven version in the pom file under "aem-core-wcm-components-master\aem-core-wcm-components-master\parent\pom.xml" as below(Possibly which your current maven version.Here 3.2.5 is my local maven version)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.2.5,)</version>
</requireMavenVersion>
<requireJavaVersion>
<message>Project must be compiled with Java ${aem.java.version} or higher</message>
<version>1.${aem.java.version}</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
And also make sure that your JAVA version is 1.8.
Please find the attached screenshot of build success.
Thanks,
Views
Replies
Total Likes
Hi Lokesh,
I still see the same issue after adding maven-enforcer plugin, I am using maven 3.5.0, I changed the requireMavenVersion to 3.5.0 and using Java 1.8
Views
Replies
Total Likes
Hello Ratna,
The link you provided, it doesn't solve the issue.
i am using AEM 6.3 + SP1, i included following dependency .
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock</artifactId>
<version>2.2.2</version>
<scope>test</scope>
</dependency>
Given below is my test class.
@Rule
public AemContext aemContext = new AemContext(appContextSetup, ResourceResolverType.RESOURCERESOLVER_MOCK);
@Test
public void resourceTest() {
ResourceResolver resolver = aemContext.resourceResolver();
assertNotNull(resolver);
}
When i try to execute i get
could you please help me with it.
i am stuck here.
Thank you.
Saurabh
Views
Replies
Total Likes
To resolve the No OSGi SCR metadata found error, you need to follow the instructions here: Apache Felix - Apache Felix Bundle Plugin Frequently Asked Questions
Hi Shajiahmed,
I too faced the same issue, but once I tried to build the project and then ran test cases.All cases passed for me.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies