を解決された後、私は他のサブプロジェクトA.に依存サブプロジェクトBを持ってメイクジップタスクの実行の依存関係が
dependencies {
compile project(':projA')
}
私のサブの両方プロジェクトAとBはリリース時にバンドルされたジップを作成します。サブプロジェクトAを参照しなくても、サブプロジェクトAに属するいくつかのファイルをサブプロジェクトBにコピーしたいと考えています。ルートプロジェクトの "build.gradle"スクリプトには次のタスクが含まれています。
subprojects {
task bundleBin(type: Zip) {
description 'Creates "bin.zip" bundle.'
dependsOn build
def bundleName = "$outputName-bin"
/// THIS DOES NOT WORK
def deps = configurations.runtime.getAllDependencies().findAll { it instanceof ProjectDependency }
println "GROOT: " + deps
into("$bundleName/dep") {
/// THE LINE BELOW WORKS
/// I do not want a fixed reference since it is already defined in each subproject's "build.gradle" file
//from project(':projA').file('conf/')
for (dep in deps) {
def proj = dep.getDependencyProject()
from (proj.projectDir) {
include "conf/"
include "scripts/"
}
}
}
into(bundleName) {
from(".") {
include "conf/"
include "scripts/"
}
}
into("$bundleName/lib") {
from configurations.runtime.allArtifacts.files
from configurations.runtime
}
archiveName = "${bundleName}.zip"
}
}
私はいくつかの他のプロジェクトに依存し、私が個別に各依存関係を維持したくないプロジェクトのリストを持っているので、私は再びサブプロジェクトAを参照するようにしたくない理由があります。
上記のスクリプトを実行するには、Bを実行するときにAとBで "conf /"と "scripts /"をとり、 "B-bin.zip"に入れます。一方、AとBに依存するサブプロジェクトCがある場合、上記のスクリプトはA、B、Cで "conf /"と "scripts /"をとり、 "C-bin.zip"に入れます。
上記のスクリプトを実行すると、doLastでカプセル化しない限り、依存関係は表示されません。ただし、これはZipタスクでは機能しません。
私の質問は、これをどのように修正するのですか?