Gradle排除模块不工作

时间:2017-12-28 08:39:54

标签: gradle birt

我正在尝试使用最新的BIRT版本,这是我的依赖:

compile ('org.eclipse.birt.runtime:org.eclipse.birt.runtime:4.6.0-20160607') {
  exclude(module:'org.apache.poi')
}

并且遇到了这样的错误:

Could not resolve all dependencies for configuration ':compile'.
Could not find any version that matches org.eclipse.scout.sdk.deps:org.eclipse.osgi:[3.11.0,3.11.1).  
Versions that do not match:
     3.11.0.v20160603-1336
     3.10.100.v20150529-1857   Required by:
     :tangio:unspecified > org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342
     :tangio:unspecified > org.eclipse.scout.sdk.deps:org.eclipse.core.filesystem:1.6.0.v20160503-1608

我不确定错误的含义以及它获取两个不同版本的位置,所以为了避免我试图强制gradle使用特定版本。

所以我当前的gradle依赖:

compile('org.eclipse.birt.runtime:org.eclipse.birt.runtime:4.6.0-20160607') {
    exclude(module:'org.apache.poi')
    exclude(group: 'org.eclipse.birt.runtime', module: 'org.eclipse.orbit.mongodb')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.osgi')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.equinox.common')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.jobs')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.equinox.registry')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.equinox.preferences')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.contenttype')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.runtime')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.expressions')
    exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.filesystem')
    transitive = false
    //compile group: 'org.eclipse.scout.sdk.deps', name: 'org.eclipse.core.runtime', version: '3.12.0.v20160606-1342'
}

compile ('org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.equinox.preferences:3.6.0.v20160120-1756'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.equinox.registry:3.6.100.v20160223-2218'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.core.contenttype:3.5.100.v20160418-1621'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:3.8.0.v20160509-1230'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.core.expressions:3.5.100.v20160418-1621'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.osgi:3.11.0.v20160603-1336'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.core.filesystem:1.6.0.v20160503-1608'){
    force = true
}
compile('org.eclipse.scout.sdk.deps:org.eclipse.core.resources:3.11.0.v20160503-1608'){
    force = true
}

但仍然得到同样的错误。如何强制Gradle包含单个版本?

1 个答案:

答案 0 :(得分:1)

请尝试以下几行:

configurations.all {
  resolutionStrategy {
    force 'org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:3.8.0.v20160509-0411'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.equinox.preferences:3.6.0.v20160120-1756'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.equinox.registry:3.6.100.v20160223-2218'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.core.contenttype:3.5.100.v20160418-1621'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:3.8.0.v20160509-1230'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.core.expressions:3.5.100.v20160418-1621'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.osgi:3.11.0.v20160603-1336'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.core.filesystem:1.6.0.v20160503-1608'
    force 'org.eclipse.scout.sdk.deps:org.eclipse.core.resources:3.11.0.v20160503-1608'
  }
}

注意:我添加了额外的行force 'org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:3.8.0.v20160509-0411',因为./gradlew dependencies会失败:

+--- org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.osgi:[3.11.0,3.11.1) -> 3.11.0.v20160603-1336
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:[3.8.0,3.8.1) -> 3.8.0.v20160509-1230
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:[3.8.0,3.8.1) FAILED

现在,dependencies闭包看起来像这样:

dependencies {
    compile('org.eclipse.birt.runtime:org.eclipse.birt.runtime:4.6.0-20160607') {
        exclude(module:'org.apache.poi')
        exclude(group: 'org.eclipse.birt.runtime', module: 'org.eclipse.orbit.mongodb')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.osgi')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.equinox.common')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.jobs')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.equinox.registry')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.equinox.preferences')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.contenttype')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.runtime')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.expressions')
        exclude(group: 'org.eclipse.scout.sdk.deps', module: 'org.eclipse.core.filesystem')
        transitive = false
        //compile group: 'org.eclipse.scout.sdk.deps', name: 'org.eclipse.core.runtime', version: '3.12.0.v20160606-1342'
    }

    compile('org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.equinox.preferences:3.6.0.v20160120-1756')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.equinox.registry:3.6.100.v20160223-2218')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.core.contenttype:3.5.100.v20160418-1621')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:3.8.0.v20160509-1230')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.core.expressions:3.5.100.v20160418-1621')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.osgi:3.11.0.v20160603-1336')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.core.filesystem:1.6.0.v20160503-1608')
    compile('org.eclipse.scout.sdk.deps:org.eclipse.core.resources:3.11.0.v20160503-1608')
}

这是./gradlew dependencies输出:

compile - Dependencies for source set 'main' (deprecated, use 'implementation ' instead).
+--- org.apache.commons:commons-math3:3.6.1
+--- com.google.guava:guava:22.0
|    +--- com.google.code.findbugs:jsr305:1.3.9
|    +--- com.google.errorprone:error_prone_annotations:2.0.18
|    +--- com.google.j2objc:j2objc-annotations:1.1
|    \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
+--- org.eclipse.birt.runtime:org.eclipse.birt.runtime:4.6.0-20160607
+--- org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:3.12.0.v20160606-1342
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.osgi:[3.11.0,3.11.1) -> 3.11.0.v20160603-1336
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:[3.8.0,3.8.1) -> 3.8.0.v20160509-1230
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.core.jobs:[3.8.0,3.8.1) -> 3.8.0.v20160509-0411
|    |    \--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:[3.8.0,3.8.1) -> 3.8.0.v20160509-1230
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.registry:[3.6.100,3.6.101) -> 3.6.100.v20160223-2218
|    |    \--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:[3.8.0,3.8.1) -> 3.8.0.v20160509-1230
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.preferences:[3.6.0,3.6.1) -> 3.6.0.v20160120-1756
|    |    \--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:[3.8.0,3.8.1) -> 3.8.0.v20160509-1230
|    \--- org.eclipse.scout.sdk.deps:org.eclipse.core.contenttype:[3.5.100,3.5.101) -> 3.5.100.v20160418-1621
|         +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.preferences:[3.6.0,3.6.1) -> 3.6.0.v20160120-1756 (*)
|         +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.registry:[3.6.100,3.6.101) -> 3.6.100.v20160223-2218 (*)
|         \--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:[3.8.0,3.8.1) -> 3.8.0.v20160509-1230
+--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.preferences:3.6.0.v20160120-1756 (*)
+--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.registry:3.6.100.v20160223-2218 (*)
+--- org.eclipse.scout.sdk.deps:org.eclipse.core.contenttype:3.5.100.v20160418-1621 (*)
+--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:3.8.0.v20160509-1230
+--- org.eclipse.scout.sdk.deps:org.eclipse.core.expressions:3.5.100.v20160418-1621
|    \--- org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:[3.12.0,3.12.1) -> 3.12.0.v20160606-1342 (*)
+--- org.eclipse.scout.sdk.deps:org.eclipse.osgi:3.11.0.v20160603-1336
+--- org.eclipse.scout.sdk.deps:org.eclipse.core.filesystem:1.6.0.v20160503-1608
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.common:[3.8.0,3.8.1) -> 3.8.0.v20160509-1230
|    +--- org.eclipse.scout.sdk.deps:org.eclipse.equinox.registry:[3.6.100,3.6.101) -> 3.6.100.v20160223-2218 (*)
|    \--- org.eclipse.scout.sdk.deps:org.eclipse.osgi:[3.11.0,3.11.1) -> 3.11.0.v20160603-1336
\--- org.eclipse.scout.sdk.deps:org.eclipse.core.resources:3.11.0.v20160503-1608
     +--- org.eclipse.scout.sdk.deps:org.eclipse.core.expressions:[3.5.100,3.5.101) -> 3.5.100.v20160418-1621 (*)
     +--- org.eclipse.scout.sdk.deps:org.eclipse.core.filesystem:[1.6.0,1.6.1) -> 1.6.0.v20160503-1608 (*)
     \--- org.eclipse.scout.sdk.deps:org.eclipse.core.runtime:[3.12.0,3.12.1) -> 3.12.0.v20160606-1342 (*)