问题描述
当我连接新库 robovm-rt 时,gradle 发誓我在另一个库中已经有几个这样的类:
Duplicate class org.apache.commons.logging.Log found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.LogFactory found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.LogFactory$1 found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.impl.NoOpLog found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
Duplicate class org.apache.commons.logging.impl.SimpleLog found in modules robovm-rt-2.3.5 (com.mobidevelop.robovm:robovm-rt:2.3.5) and spring-jcl-5.1.2.RELEASE (org.springframework:spring-jcl:5.1.2.RELEASE)
我尝试以不同的方式从库中排除这些 Apache 类,但它们都不起作用,问题仍然存在。不工作的选项:
选项 1:
implementation (group: 'com.mobidevelop.robovm',name: 'robovm-rt',version: '2.3.5') {
exclude group: 'commons-logging',module: 'commons-logging'
}
选项 2:
implementation (group: 'com.mobidevelop.robovm',version: '2.3.5') {
exclude group: 'org.apache.commons',module: 'commons-logging'
}
排除这些类以使它们不重复的正确方法是什么?
解决方法
回答我的问题,我只是从第一个库中而不是从第二个库中排除了模块 - spring-boot-starter-websocket
implementation('org.springframework.boot:spring-boot-starter-websocket') {
exclude group: 'org.springframework',module: 'spring-jcl'
}