adobe / aem-project-archetype

Maven template to create best-practice websites on AEM.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
Apache License 2.0
541 stars 417 forks source link

Duplicate SLF4J bindings on Core when executing tests #741

Open kwin opened 3 years ago

kwin commented 3 years ago

Expected Behaviour

mvn test does not emit any warning

Actual Behaviour

The following warning is emitted

...
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ mysite.core ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.mysite.core.filters.LoggingFilterTest
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/konradwindszus/.m2/repository/uk/org/lidalia/slf4j-test/1.0.1/slf4j-test-1.0.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/konradwindszus/.m2/repository/com/adobe/aem/aem-sdk-api/2021.6.5540.20210615T210737Z-210527/aem-sdk-api-2021.6.5540.20210615T210737Z-210527.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [uk.org.lidalia.slf4jtest.TestLoggerFactory]
...

Cause

Both the aem-sdk-api dependency (https://github.com/adobe/aem-project-archetype/blob/fc1b073d5628d0f2f3a91adf3b96cace31d133f3/src/main/archetype/core/pom.xml#L169) and lidalia (https://github.com/adobe/aem-project-archetype/blob/fc1b073d5628d0f2f3a91adf3b96cace31d133f3/src/main/archetype/core/pom.xml#L85) contain a SLF4J implementation.

I recommend to get rid of Lidalia (https://github.com/Mahoney/lidalia-slf4j-ext) as it seems basically dead (last release in 2013) and also cover pretty much an edge case (i.e. no a good example to place into a generic archetype).

VolodymyrSinkov commented 1 year ago

Also want to highlight https://github.com/adobe/aem-core-wcm-components/issues/1544 which outlines performance issues that uk.org.lidalia - slf4j-test causes.

Removing this dependency within our codebase allowed to speed up build time by crazy 80% percent.

vhochstein commented 3 months ago

@cziegeler just found that by accident. and remove that lib... Old: [INFO] B2BChannels - Integration Tests .................... SUCCESS [ 26.825 s] New: [INFO] B2BChannels - Integration Tests .................... SUCCESS [ 2.934 s] Old: [INFO] B2BChannels - Core ................................. SUCCESS [ 42.185 s] New: [INFO] B2BChannels - Core ................................. SUCCESS [ 24.289 s]

I think it is a really good idea to remove that outdated Lidalia.