aem-project-archetype icon indicating copy to clipboard operation
aem-project-archetype copied to clipboard

Duplicate SLF4J bindings on Core when executing tests

Open kwin opened this issue 3 years ago • 2 comments

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).

kwin avatar Jun 24 '21 13:06 kwin

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.

VolodymyrSinkov avatar Aug 24 '23 16:08 VolodymyrSinkov

@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.

vhochstein avatar Apr 29 '24 09:04 vhochstein