quarkus: SplitPackageProcessor picks up duplicates via test-jar that are not actually in that test-jar

Describe the bug

With 2.1.0, when running tests in some of our modules, we are seeing this:

2021-07-27 16:57:00,819 WARN  [io.qua.arc.dep.SplitPackageProcessor] (build-28) Detected a split package usage which is considered a bad practice and should be avoided. Following packages were detected in multiple archives: 
 - "de.somecompany.someproject.register.user" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.persistence.entity.id" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.catalog" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.somelib.persistence.transaction" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.somelib.logging" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.application.ehba" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.persistence.entity" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.password" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.application.smcb" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.confirmingauthority" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.somelib.persistence.entity.id" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.context" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.user.mapper" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.persistence.liquibase" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.persistence.entity.catalog" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.validation" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.persistence" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.file" found in [de.somecompany.someproject:register-core]
 - "de.somecompany.someproject.register.confirmingauthority.mapper" found in [de.somecompany.someproject:register-core]

What’s interesting is that only a single artifact is listed (de.somecompany.someproject:register-core). That register-core module is producing a test-jar that is present on the test classpath of the module that is issuing the warnings (here: register-api). That test-jar of register-core has a distinct package, but maybe the processor is somehow confused with this?

Expected behavior

No such warnings.

Actual behavior

Many warnings.

How to Reproduce?

See https://github.com/quarkusio/quarkus/issues/19030#issuecomment-889508677

Output of uname -a or ver

Linux W4DEUMSY9003463 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux But also happens on Jenkins.

Output of java -version

OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

GraalVM version (if different from Java)

n/a

Quarkus version or git rev

2.1.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1

Additional information

n/a

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (16 by maintainers)

Most upvoted comments

@aloubyansky I recycled an older example project (which has a weird name 😉 ): https://github.com/famod/modmono-quarkus/tree/issue-19030-test-jar-index (make sure to switch to branch issue-19030-test-jar-index!)

mvn clean install will yield during testing in dist module:

WARN  [io.qua.arc.dep.SplitPackageProcessor] (build-5) Detected a split package usage which is considered a bad practice and should be avoided. Following packages were detected in multiple archives:
- "com.github.famod.modmono_quarkus.core" found in [com.github.famod.modmono-quarkus:modmono-quarkus-core]

or with 999-SNAPSHOT a bit more detailed:

WARN  [io.qua.arc.dep.SplitPackageProcessor] (build-21) Detected a split package usage which is considered a bad practice and should be avoided. Following packages were detected in multiple archives:
- "com.github.famod.modmono_quarkus.core" found in [com.github.famod.modmono-quarkus:modmono-quarkus-core::jar, com.github.famod.modmono-quarkus:modmono-quarkus-core:tests:jar]

How is that a problem here? Why should register-core (the main jar) be considered equal to register-core test-jar? Or am I getting you wrong?

You are correct that they shouldn’t be equal. All I am saying is that the Set<String> that is used in current impl introduces this problem because both your JARs will generate the same String.

@manovotn

which led to creation of the set that now has the problem with uniqueness of its elements

How is that a problem here? Why should register-core (the main jar) be considered equal to register-core test-jar? Or am I getting you wrong?

@aloubyansky

are you going to look into adding hashCode/equals to the ApplicationArchiveImpl?

No time for that, sorry. As I stated previously, this is not the main problem here (which doesn’t mean it shouldn’t be addressed), it’s the index for that test-jar that contains too many known classes.