0

依存しているプロジェクト (compile("foobar")) から推移的な依存関係のみを取得し、他のすべての推移性を無効にするように hibernate を構成することは可能ですか? それが私がこれまでに試したことです:

configurations.all {
    transitive = false
}
dependencies {
    compile (project(':foobar')) {
        transitive = true
    }
}

そうはいきません。推移的な依存関係はまったくプルされません。

提案されたように1を更新

configurations.all {
    dependencies.matching { it.name != 'foobar' }.all {
        transitive = false
    }
}

ただし、foobar からの依存関係は考慮されません。

compile - Compile classpath for source set 'main'.
+--- project :foobar
+--- junit:junit:3.8.1
+--- org.hibernate:hibernate-c3p0:3.5.6-Final
+--- org.hibernate:hibernate-commons-annotations:3.2.0.Final
+--- org.hibernate:hibernate-ehcache:3.5.6-Final
+--- org.hibernate:hibernate-entitymanager:3.5.6-Final
+--- org.hibernate:hibernate-envers:3.5.6-Final
+--- org.hibernate:hibernate-jmx:3.5.6-Final
+--- postgresql:postgresql:9.1-901.jdbc4
+--- aspectj:aspectjrt:1.5.2
+--- org.apache.tomcat:tomcat-jdbc:7.0.30
\--- org.easymock:easymock:3.2

更新 2

次の解決策は今私のために働きます:

dependencies {
    compile project(':foobar')

    compile('org.springframework:spring:2.5.6') { transitive = false }
    compile('org.springframework:spring-mock:2.0.3') { transitive = false }
}
4

2 に答える 2

2

Gradle は現在、目的の動作をグローバルに構成することをサポートしていません。ただし、依存関係ごとに明示的に指定することで可能です。

dependencies {
   compile project(':foobar')

   compile('org.springframework:spring:2.5.6') { transitive = false }
   compile('org.springframework:spring-mock:2.0.3') { transitive = false }
}

トリックを行います。あまり良くありませんが、働いています。

于 2015-09-23T07:29:52.333 に答える