2016-04-19 4 views
1

に情報を添付するには、宣言:のGradle - 私はいくつかの依存関係を持っている依存

runtime 'org.apache.commons:commons-lang3:3.4' 
runtime 'commons-collections:commons-collections:3.2.2' 
runtime 'commons-io:commons-io:1.3.2' 

私はコピーの依存タスクがあります。

task copyRuntimeLibs(type: Copy) { 
    into "build/dependencies" 
    from configurations.runtime 
} 

私はいくつかの依存関係では「マーク」のことができるようにしたいと思いますが後でそれらを別のフォルダのcopyRuntimeLibsにルーティングするために使用します。次のようなもの:

runtime 'commons-io:commons-io:1.3.2' { subdir='dir1' } 
runtime 'commons-collections:commons-collections:3.2.2' { subdir='dir2' } 
runtime 'commons-io:commons-io:1.3.2' { subdir='dir3' } 

これは可能ですか?あなたは、すべてのランタイムに貢献複数のカスタム設定を定義でき

答えて

0

:あなたのコピータスクで

configurations{ 
    subRun1 
    subRun2 
    subRun3 
    runtime.extendsFrom(subRun1, subRun2, subRun3) 
} 

を、あなたはそれぞれのフォルダに各サブコンからコピーすることができます。

task copySubRun1Libs(type: Copy) { 
    into "build/dependencies/dir1" 
    from configurations.subRun1 
} 

ので、に。

+0

ありがとうございました。それは私も思っていましたが、カスタムビヘイビアごとに1つの設定を定義するよりも短い方法が必要でした。私が依存関係に2番目の情報を添付したいのであれば、かなり面倒なことになるでしょう。 – bananasplit