DEV Community

Query Filter
Query Filter

Posted on

docker17

// 1. Keep your task definition as is
tasks.register('buildAnsibleTar', Tar) {
    archiveFileName = "ansible.tar.gz"
    destinationDirectory = file("$buildDir/distributions")
    compression = Compression.GZIP
    from(tasks.named('buildRpm'))
    from("${projectDir}/ansible") { into('ansible') }
}

// 2. The Direct Dependency Chain (No Lifecycle Hooks)
// This links the files directly without touching 'build' or 'assemble'
tasks.named('buildRpm') {
    dependsOn tasks.named('jar')
}

tasks.named('buildAnsibleTar') {
    dependsOn tasks.named('buildRpm')
}

// 3. Only hook into Publish
// This ensures that when you upload to Artifactory, the TAR is ready.
tasks.named('publish') {
    dependsOn tasks.named('buildAnsibleTar')
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)