Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.1
-
Fix Version/s: 2.1
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
When creating an uberjar, sometimes the same class is present in two or more dependencies' JARs. For each class, maven-shade-plugin issues a WARNING We have a duplicate in.
This is annoying and can muddle newcomers up (like myself), because it's not clear how to fix.
I don't know if a programmatic solution to these warnings could exist: maybe it will always require human interaction. However, it's better to point users in the right direction and not spit out thousands of useless warnings.
Attached is a pom which triggers thousands of warnings and a patch with a prettier (and hopefully more useful) output like
[WARNING] bcprov-jdk14-138.jar, bcprov-jdk14-1.38.jar define 1292 overlappping classes:
[WARNING] - org.bouncycastle.asn1.ocsp.ResponderID
[WARNING] - org.bouncycastle.crypto.params.DSAPublicKeyParameters
[WARNING] - org.bouncycastle.crypto.engines.DESEngine
[WARNING] - org.bouncycastle.jce.provider.JCEElGamalPrivateKey
[WARNING] - org.bouncycastle.jce.provider.JCEStreamCipher$Skipjack_CFB8
[WARNING] - org.bouncycastle.jce.provider.JCESecretKeyFactory
[WARNING] - org.bouncycastle.i18n.filter.UntrustedInput
[WARNING] - org.bouncycastle.asn1.x9.X962NamedCurves$5
[WARNING] - org.bouncycastle.jce.X509KeyUsage
[WARNING] maven-shade-plugin has detected that some .class files
[WARNING] are present in two or more JARs. When this happens, only
[WARNING] one single version of the class is copied in the uberjar.
[WARNING] Usually this is not harmful and you can skeep these
[WARNING] warnings, otherwise try to manually exclude artifacts
[WARNING] based on mvn dependency:tree -Ddetail=true and the above
[WARNING] output
[WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
This isn't a duplicate of MSHADE-126, which is bug that generates false warnings. Rather, this issue is about improving the messages for legitimate warnings.
Please re-open and apply the patch. This is a huge improvement!