0
我有一個多積累,我需要一些依賴發佈到磁盤上的一個自定義的本地倉庫,然後將此文件夾添加到壓縮包。搖籃任務相關的動態創建的任務
我定義了使用Maven的插件發佈各子項目發佈任務。
subprojects {
apply plugin: 'maven-publish'
configurations {
offlineDependencies
}
publishing {
publications {
configurations.each { config ->
if (config.name == "offlineDependencies") {
def files = config.files
config.dependencies.each { dep ->
files.each { file ->
if (file.name == "${dep.name}-${dep.version}.jar") {
"${dep.name}"(MavenPublication) {
artifact (file) {
groupId = "${dep.group}"
artifactId = "${dep.name}"
version = "${dep.version}"
}
}
}
}
}
}
}
}
repositories {
maven {
name 'dependencies'
url '../build/repository'
}
}
}
}
使用分配插件創建一個zip文件
distributions {
release {
baseName 'release'
contents {
from('src/main/resources/')
into("repository"){
from("$buildDir/repository")
}
}
}
}
我怎麼能確保所有的動態創建的發佈任務創建ZIP文件之前運行?
我試圖做一個新的任務依賴於動態創建任務的所有子項目,但似乎他們不是在那個時候還沒有建立。
subprojects {
task offlineDep << {
println 'Creating offline dependencies'
}
offlineDep.dependsOn {
tasks.findAll { task -> task.name.endsWith('PublicationToDependenciesRepository') }
}
}