我想排除一些未使用的依赖项以减少我的应用程序大小。以下是我的模块中的依赖项:
+--- project :ProjectOne
| +--- commons-io:commons-io:2.4
| \--- project :ProjectTwo
| +--- com.project:PackJPG:1.5
| +--- com.project:xz:1.2
| +--- org.ocpsoft.prettytime:prettytime:2.1.2.Final
| +--- joda-time:joda-time:2.1
| +--- project :ProjectThree
| | +--- project :Utilities
| | +--- project :ProcessPriority
| | | +--- com.nativelibs4java:bridj:0.6.2
| | | | \--- com.google.android.tools:dx:1.7
| | | +--- net.java.dev.jna:jna:4.1.0
| | | +--- net.java.dev.jna:jna-platform:4.1.0
| | | | \--- net.java.dev.jna:jna:4.1.0
| | | +--- org.tinylog:slf4j-binding:1.2
| | | | +--- org.tinylog:tinylog:1.2
| | | | \--- org.slf4j:slf4j-api:[1.6,1.8) -> 1.7.25
| | | \--- project :Utilities
| | +--- project :ProjectFour
| | | +--- commons-logging:commons-logging:1.2
| | | +--- org.tinylog:jcl-binding:1.2
| | | | +--- org.tinylog:tinylog:1.2
| | | | \--- commons-logging:commons-logging:[1.2,1.3) -> 1.2
| | | \--- commons-codec:commons-codec:1.10
| | +--- org.slf4j:log4j-over-slf4j:1.7.25
| | | \--- org.slf4j:slf4j-api:1.7.25
| | +--- org.slf4j:jul-to-slf4j:1.7.25
| | | \--- org.slf4j:slf4j-api:1.7.25
| | +--- com.google.protobuf:protobuf-java:2.6.1
| | +--- com.google.inject:guice:4.1.0
| | | +--- javax.inject:javax.inject:1
| | | \--- com.google.guava:guava:19.0
| | +--- org.bouncycastle:bcprov-jdk16:1.46
| | +--- com.google.guava:guava:19.0
| | +--- com.drewnoakes:metadata-extractor:2.9.1
| | | \--- com.adobe.xmp:xmpcore:5.1.2
| | +--- com.mixpanel:mixpanel-java:1.4.4
| | | \--- org.json:json:20090211
| | \--- com.mortennobel:java-image-scaling:0.8.6
| | \--- com.jhlabs:filters:2.0.235
| +--- project :PackJPGInterFileCompression
| | +--- project :ProjectFive (*)
| | \--- com.project:PackJPG:1.5
| +--- com.h2database:h2:1.3.176
| +--- com.google.code.gson:gson:2.7
| +--- org.json:json:20080701 -> 20090211
| \--- itadaki:jbzip2:0.9.1
我的gradle文件:
implementation (project(':ProjectOne')) {
exclude group: 'ProjectTwo'
}
即使我从ProjectOne中排除ProjectTwo,我仍然会在第3行的依赖树中找到它。我错过了什么?
答案 0 :(得分:2)
您实际上是排除了我认为您要排除完整的ProjectTwo模块的组。
如果我没错,请尝试:
configurations {
compile.exclude module: 'ProjectTwo'
}