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)

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)

解决

​ 需要用到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'
    }

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)

​ 再次构建,成功。

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)

上一篇:SpringBoot:Shiro-整合-Redis,也不用担心用户投诉啦!


下一篇:SpringBoot整合Shiro