Setting user-configured-ignored-entries does not work as expected
Describe the bug
When building an uber-jar, quarkus-maven-plugin:build complains about duplicate "Dependencies with duplicate files detected".
e.g.
[WARNING] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Dependencies with duplicate files detected. The dependencies [io.quarkus:quarkus-virtual-threads::jar:3.27.0[paths: /home/dvallant/.m2/repository/io/quarkus/quarkus-virtual-threads/3.27.0/quarkus-virtual-threads-3.27.0.jar;], io.quarkus:quarkus-core::jar:3.27.0[paths: /home/dvallant/.m2/repository/io/quarkus/quarkus-core/3.27.0/quarkus-core-3.27.0.jar;], io.quarkus:quarkus-rest::jar:3.27.0[paths: /home/dvallant/.m2/repository/io/quarkus/quarkus-rest/3.27.0/quarkus-rest-3.27.0.jar;], io.quarkus:quarkus-tls-registry::jar:3.27.0[paths: /home/dvallant/.m2/repository/io/quarkus/quarkus-tls-registry/3.27.0/quarkus-tls-registry-3.27.0.jar;], io.quarkus:quarkus-rest-common::jar:3.27.0[paths: /home/dvallant/.m2/repository/io/quarkus/quarkus-rest-common/3.27.0/quarkus-rest-common-3.27.0.jar;], io.quarkus:quarkus-vertx::jar:3.27.0[paths: /home/dvallant/.m2/repository/io/quarkus/quarkus-vertx/3.27.0/quarkus-vertx-3.27.0.jar;], io.quarkus:quarkus-vertx-http::jar:3.27.0[paths: /home/dvallant/.m2/repository/io/quarkus/quarkus-vertx-http/3.27.0/quarkus-vertx-http-3.27.0.jar;]] contain duplicate files, e.g. META-INF/quarkus-config-doc/quarkus-config-model-version
[WARNING] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Dependencies with duplicate files detected. The dependencies [org.jctools:jctools-core::jar:4.0.5[paths: /home/dvallant/.m2/repository/org/jctools/jctools-core/4.0.5/jctools-core-4.0.5.jar;], io.netty:netty-common::jar:4.1.127.Final[paths: /home/dvallant/.m2/repository/io/netty/netty-common/4.1.127.Final/netty-common-4.1.127.Final.jar;]] contain duplicate files, e.g. META-INF/maven/org.jctools/jctools-core/pom.xml
Setting quarkus.package.jar.user-configured-ignored-entries to META-INF/maven/org.jctools/jctools-core/pom.xml,META-INF/maven/org.jctools/jctools-core/pom.properties,META-INF/quarkus-config-doc/quarkus-config-model-version,META-INF/quarkus-config-doc/quarkus-config-model.json works as expected, the warnings are gone.
But excluding a file under META-INF/services, e.g. META-INF/services/org.slf4j.spi.SLF4JServiceProvider is not working (see reproducer).
Expected behavior
All files defined in quarkus.package.jar.user-configured-ignored-entries should be excluded from the final jar.
Actual behavior
Not all files defined in quarkus.package.jar.user-configured-ignored-entries are excluded from the final jar.
How to Reproduce?
Clone reproducer-quarkus-build-ignored-entries and build the project with mvn clean package.
Now have a look at the contents of the final jar: jar -tf target/reproducer-quarkus-build-ignored-entries-0.1.0-SNAPSHOT-runner.jar | grep "META-INF/services/org.slf4j.spi.SLF4JServiceProvider"
The excluded file is still part of the final jar.
Output of uname -a or ver
x86_64 GNU/Linux
Output of java -version
openjdk version "21.0.4" 2024-07-16 LTS OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode, sharing)
Quarkus version or git rev
3.27.0
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Additional information
No response
/cc @radcortez (config)
@gastaldi hadn't you fixed some similar issues in the past?
After some investigation I think the problem might be here: https://github.com/quarkusio/quarkus/blob/14c0ea435697450235f1518c2a24fc4a0d197514/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java#L514-L519
If the entry is one defined in UBER_JAR_CONCATENATED_ENTRIES_PREDICATE, which is true for META-INF/services/org.slf4j.spi.SLF4JServiceProvider, ignoredEntriesPredicate is never evaluated.
It would possibly make sense if we could configure the entries to be merged. In my case this would solve my problem of having 2 different implementations of org.slf4j.spi.SLF4JServiceProvider.
It seems you need to exclude transitive SLF4J impl dependencies?
It seems you need to exclude transitive SLF4J impl dependencies?
Unfortunately, it's not that easy. I'm trying to use quarkus-logging-logback, because I need to split logs by MDC attribute using a SiftingAppender. The dependency I think that includes ch.qos.logback.classic.spi.LogbackServiceProvider is not in the dependency tree. So I can't exclude it. There is also an open issue: quarkiverse/quarkus-logging-logback#197
This might be a fix for the issue: fix-ignoredEntries.patch