Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Archetype 22 mvn clean install failing test cases. surefire plugin

Avatar

Level 3

Hi,

I have created maven archetype 22 project, when i do "mvn clean install" i am seeing maven surefire plugin failing the build with below error.                    I am behind the corporate firewall running aem project inside VM . AEM version mentioned as 6.5.3 in below command

mvn archetype:generate -B \
  -DarchetypeGroupId=com.adobe.granite.archetypes \
  -DarchetypeArtifactId=aem-project-archetype \
  -DarchetypeVersion=22 \
  -DgroupId=com.adobe.aem.guides \
  -Dversion=0.0.1-SNAPSHOT \
  -DappsFolderName=wknd \
  -DartifactId=aem-guides-wknd \
  -Dpackage=com.adobe.aem.guides.wknd \
  -DartifactName="WKND Sites Project" \
  -DcomponentGroupName=WKND \
  -DconfFolderName=wknd \
  -DcontentFolderName=wknd \
  -DcssId=wknd \
  -DisSingleCountryWebsite=n \
  -Dlanguage_country=en_us \
  -DoptionAemVersion=6.5.3 \
  -DoptionDispatcherConfig=none \
  -DoptionIncludeErrorHandler=n \
  -DoptionIncludeExamples=n \
  -DoptionIncludeFrontendModule=y \
  -DpackageGroup=wknd \
  -DsiteName="WKND Site"

        

 

 

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.295 s
[INFO] Finished at: 2020-06-28T00:33:12+00:00
[INFO] Final Memory: 46M/746M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project aem-guides-wknd.core: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/user746/develop/aem-guides-wknd/core/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project aem-guides-wknd.core: There are test failures.

Please refer to /home/user746/develop/aem-guides-wknd/core/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /home/user746/develop/aem-guides-wknd/core/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
	at org.apache.maven.plugin.surefire.SurefireHelper.throwException(SurefireHelper.java:289)
	at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:161)
	at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:364)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1041)
	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
[ERROR] 

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

6.5
1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @ramaem12

It is breaking for me too. Please comment it out for OOTB Junit's classes and run "mvn clean isntall" it is breaking for me too.


@Theo_Pendle : Below are the Junit's for three classes it is breaking for:

 

error.PNG


It is failing because of multiple SLF4J binding.

error_1.png

 

To resolve this issue we need to exclude the duplicate dependency in POM .xml.

View solution in original post

6 Replies

Avatar

Level 3

We are seeing the below issue in Debug mode, when we mention 6.5.3 in maven archetype version 22

 

18:43:26.241 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - Trying adapter factory io.wcm.testing.mock.aem.MockAemAdapterFactory@5d8445d7 to map MockResource [path=/content/mypage/jcr:content, props=org.apache.sling.testing.resourceresolver.MockValueMap@1385b23d : org.apache.sling.testing.resourceresolver.ValueMapDecorator@1385b23d : {jcr:primaryType=cq:PageContent, jcr:title=mypage, cq:template=/apps/sample/templates/template1}] to interface com.day.cq.wcm.api.Page
18:43:26.241 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - No adapter factory found to map MockResource [path=/content/mypage/jcr:content, props=org.apache.sling.testing.resourceresolver.MockValueMap@1385b23d : org.apache.sling.testing.resourceresolver.ValueMapDecorator@1385b23d : {jcr:primaryType=cq:PageContent, jcr:title=mypage, cq:template=/apps/sample/templates/template1}] to interface javax.jcr.Node
18:43:26.242 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - No adapter factory found to map MockResource [path=/content/mypage/jcr:content, props=org.apache.sling.testing.resourceresolver.MockValueMap@1385b23d : org.apache.sling.testing.resourceresolver.ValueMapDecorator@1385b23d : {jcr:primaryType=cq:PageContent, jcr:title=mypage, cq:template=/apps/sample/templates/template1}] to interface com.day.cq.wcm.api.Page
18:43:26.242 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - Trying adapter factory io.wcm.testing.mock.aem.MockAemAdapterFactory@5d8445d7 to map MockResource [path=/content/mypage, props=org.apache.sling.testing.resourceresolver.MockValueMap@77b22680 : org.apache.sling.testing.resourceresolver.ValueMapDecorator@77b22680 : {jcr:primaryType=cq:Page}] to interface com.day.cq.wcm.api.Page
18:43:26.242 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - No adapter factory found to map MockResource [path=/content/mypage, props=org.apache.sling.testing.resourceresolver.MockValueMap@77b22680 : org.apache.sling.testing.resourceresolver.ValueMapDecorator@77b22680 : {jcr:primaryType=cq:Page}] to interface javax.jcr.Node
18:43:26.242 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - Using adapter factory io.wcm.testing.mock.aem.MockAemAdapterFactory@5d8445d7 to map MockResource [path=/content/mypage, props=org.apache.sling.testing.resourceresolver.MockValueMap@77b22680 : org.apache.sling.testing.resourceresolver.ValueMapDecorator@77b22680 : {jcr:primaryType=cq:Page}] to interface com.day.cq.wcm.api.Page
18:43:26.242 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - Using adapter factory org.apache.sling.models.impl.ModelAdapterFactory@5af9926a to map MockResource [path=/content/mypage/jcr:content/hello, props=org.apache.sling.testing.resourceresolver.MockValueMap@18a06873 : org.apache.sling.testing.resourceresolver.ValueMapDecorator@18a06873 : {sling:resourceType=wknd/components/content/helloworld}] to class com.adobe.aem.guides.wknd.core.models.HelloWorldModel
18:43:26.243 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - No adapter factory found to map org.apache.sling.testing.resourceresolver.MockResourceResolver@37d80fe7 to interface javax.jcr.Session
18:43:26.244 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - Unregistered service org.apache.sling.adapter.Adaption with adaptables : [org.apache.sling.api.resource.Resource] and adapters : [com.adobe.aem.guides.wknd.core.models.HelloWorldModel]

 

 

Avatar

Level 3

and below is the dependency tree -

 

[INFO] --- maven-dependency-plugin:3.0.0:tree (default-cli) @ aem-guides-wknd.it.launcher ---
[INFO] com.adobe.aem.guides:aem-guides-wknd.it.launcher:jar:0.0.1-SNAPSHOT
[INFO] +- org.apache.sling:org.apache.sling.junit.core:jar:1.0.8:provided
[INFO] +- org.apache.sling:org.apache.sling.junit.scriptable:jar:1.0.12:provided
[INFO] +- org.apache.sling:org.apache.sling.junit.remote:jar:1.0.8:provided
[INFO] |  \- junit:junit:jar:4.8.2:provided
[INFO] +- org.apache.sling:org.apache.sling.testing.tools:jar:1.0.8:provided
[INFO] |  +- org.apache.commons:commons-exec:jar:1.1:provided
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.8:provided
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.4:provided
[INFO] |  |  +- commons-logging:commons-logging:jar:1.2:provided
[INFO] |  |  \- commons-codec:commons-codec:jar:1.13:provided
[INFO] |  \- org.apache.httpcomponents:httpmime:jar:4.1:provided
[INFO] +- org.apache.sling:org.apache.sling.servlets.post:jar:2.3.4:provided
[INFO] +- org.apache.sling:org.apache.sling.commons.json:jar:2.0.6:compile
[INFO] +- org.apache.sling:org.apache.sling.launchpad:jar:standalone:6:compile
[INFO] |  \- org.apache.sling:org.apache.sling.launchpad.base:war:webapp:2.3.0:runtime
[INFO] +- org.slf4j:slf4j-api:jar:1.7.21:provided
[INFO] +- commons-io:commons-io:jar:1.4:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.25:test
[INFO] +- org.junit.jupiter:junit-jupiter:jar:5.4.1:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-api:jar:5.4.1:test
[INFO] |  |  +- org.opentest4j:opentest4j:jar:1.1.1:test
[INFO] |  |  \- org.junit.platform:junit-platform-commons:jar:1.4.1:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-params:jar:5.4.1:test
[INFO] |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.4.1:test
[INFO] +- org.junit.vintage:junit-vintage-engine:jar:5.4.1:test
[INFO] |  +- org.apiguardian:apiguardian-api:jar:1.0.0:test
[INFO] |  \- org.junit.platform:junit-platform-engine:jar:1.4.1:test
[INFO] +- com.adobe.aem.guides:aem-guides-wknd.it.tests:jar:0.0.1-SNAPSHOT:compile
[INFO] \- com.adobe.aem.guides:aem-guides-wknd.core:jar:0.0.1-SNAPSHOT:compile

Avatar

Correct answer by
Level 3

Hi @ramaem12

It is breaking for me too. Please comment it out for OOTB Junit's classes and run "mvn clean isntall" it is breaking for me too.


@Theo_Pendle : Below are the Junit's for three classes it is breaking for:

 

error.PNG


It is failing because of multiple SLF4J binding.

error_1.png

 

To resolve this issue we need to exclude the duplicate dependency in POM .xml.

Avatar

Level 3

Hi toimrank,

I am not getting above you mentioned slf4j issue in my local. However, below is the error we are getting and also attaching my dependency tree for reference.

 

com.adobe.aem.guides.wknd.core.filters.LoggingFilter - request for /content/test, with selector selectors
13:39:37.461 [main] DEBUG org.apache.sling.testing.mock.sling.MockAdapterManagerImpl - No adapter factory found to map org.apache.sling.testing.resourceresolver.MockResourceResolver@67427b69 to interface javax.jcr.Session

 

,vn dependency: tree in 6.5.3,vn dependency: tree in 6.5.3

 

 

Avatar

Level 1

Has the issue resolved? Why the log is saying " No adapter found to map the mock resource"? Any lead is helpful. Thanks!