一个既简单又不简单的问题:从Maven项目依赖项中排除依赖项 (Excluding a Dependency from the Maven Project Dependencies)
jar 包冲突,如何解决?
以 国密算法sm3为例:
最近用到国密算法sm3算法,报错 java.lang.SecurityException: class "org.bouncycastle.crypto.digests.GeneralDigest"'s signer information does not match signer information of other classes in the same package
     
 一、原因
 jar 包冲突
 二、解决
 *尝试方案一:
 项目是maven项目,使用命令:dependency:tree -Dverbose -Dincludes=:bcprov-jdk
 找出此bcprov-jdk14-136.jar包的依赖关系,如下所示:
mvn dependency:tree -Dverbose -Dincludes=:bcprov-jdk
[INFO] Verbose not supported since maven-dependency-plugin 3.0
 。。。
提示不支持,继续尝试
*尝试方案二:
 dependency:tree
手动查找 关键词bcprov-jdk
涉及到的jar,进行排除即可:
             <exclusions>
                 <exclusion>
                     <groupId>org.bouncycastle</groupId>
                     <artifactId>bcprov-jdk14</artifactId>
                 </exclusion>
             </exclusions>









