Duplicate class xx.xx.XX found in modules xx1-1.0 (xx.xx:mm1:1.0),... and xx2-1.0 (xx.xx:mm2:1.0)


性状

​ 假设引入包implementation ("org.apache.shiro:shiro-core:1.4.2")

​ 报错信息形如:Duplicate class xx.xx.XX found in modules xx1-1.0 (xx.xx:mm1:1.0),... and xx2-1.0 (xx.xx:mm2:1.0)

e08c1414e00962eb

解决

​ 需要用到exclude标签。

​ 根据Duplicate class xx.xx.XX found in modules xx1-1.0 (xx.xx:mm1:1.0),... and xx2-1.0 (xx.xx:mm2:1.0),可知xx1与xx2中有重复项,后面括号就是具体位置,假设保留mm1如此就可以exclude group: 'xx.xx', module: 'mm2'解决。

​ 将上面改为:

implementation ("org.apache.shiro:shiro-core:1.4.2") {
        exclude group: 'org.apache.shiro', module: 'shiro-lang'
        exclude group: 'org.apache.shiro', module: 'shiro-event'
        exclude group: 'org.apache.shiro', module: 'shiro-crypto-hash'
        exclude group: 'org.apache.shiro', module: 'shiro-crypto-core'
        exclude group: 'org.apache.shiro', module: 'shiro-crypto-cipher'
        exclude group: 'org.apache.shiro', module: 'shiro-config-ogdl'
        exclude group: 'org.apache.shiro', module: 'shiro-cache'
        exclude group: 'org.apache.shiro', module: 'shiro-config-core'
    }

79f6d618d8da64e2

​ 再次构建,成功。

e1fa7df7b1159cdc

声明:HEUE NOTE|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA 4.0协议进行授权

转载:转载请注明原文链接 - Duplicate class xx.xx.XX found in modules xx1-1.0 (xx.xx:mm1:1.0),... and xx2-1.0 (xx.xx:mm2:1.0)