Pantsbuild: how to skip JVM class duplicates for a Scala library?

66 views Asked by At

I'm using pants v1.30.0 and I need to find a workaround to build a Scala fat JAR that includes pureconfig v0.14.0.

Pantsbuild detect-duplicates:

Detect JVM classes and resources with the same qualified name on the classpath.

I'm experiencing the following issue:

$ ./pants detect-duplicates src/scala/myapp:main
...
 [detect-duplicates]

                    ===== For target JvmBinary(src/scala/services/http4s_poc:main):
                   Duplicate classes and/or resources detected in artifacts: ('com.github.pureconfig-pureconfig-core_2.12-0.14.0.jar', 'com.github.pureconfig-pureconfig-macros_2.12-0.14.0.jar')
                        pureconfig/DerivationMacros$$anon$5.class
                        pureconfig/derivation/LazyContextParser.class
                        pureconfig/DerivationMacros$$typecreator2$1.class
                        pureconfig/DerivationMacros$$anon$1.class
                        pureconfig/derivation/LazyContextParser$LazyContext$.class
                        pureconfig/DerivationMacros$$anonfun$$nestedInanonfun$buildImplicitNotFound$1$1.class
                        pureconfig/Derivation$Successful$.class
                        pureconfig/derivation/LazyContextParser$LazyContextTree$$anon$2.class
                        pureconfig/derivation/MacroCompat$$typecreator1$1.class
                        pureconfig/Derivation$Successful.class
                        ... 20 more ...
                   Duplicate classes and/or resources detected in artifacts: ('com.github.pureconfig-pureconfig-generic-base_2.12-0.14.0.jar', 'com.github.pureconfig-pureconfig-generic_2.12-0.14.0.jar')
                        pureconfig/generic/CoproductHint$Attempt$.class
                        pureconfig/generic/CoproductHint$Use$.class
                        pureconfig/generic/error/CoproductHintException$.class
                        pureconfig/generic/ProductHint$Use.class
                        pureconfig/generic/ProductHint$Action.class
                        pureconfig/generic/ProductHint$UseOrDefault.class
                        pureconfig/generic/ProductHint$UseOrDefault$.class
                        pureconfig/generic/error/NoValidCoproductOptionFound$.class
                        pureconfig/generic/ProductHint$Use$.class
                        pureconfig/generic/ProductHintImpl.class
                        ... 18 more ...
  • Is it possible to tell pants to skip this check?
  • If I wanted to fix pureconfig duplicate issue by myself what would be the currect way to do it?

The same error has been reported on GitHub

0

There are 0 answers