Given a build.gradle and Gradle 4.10.1 below
plugins {
id("base")
}
final myTask = tasks.create("myTask") {
doFirst {
}
}
configurations.create("someConfig") {
outgoing.artifact(file("someFile.txt")) {
builtBy(myTask)
}
}
Running ./gradlew assemble --dry-run outputs:
:myTask SKIPPED
:assemble SKIPPED
Looking at The Base Plugin
assemble— lifecycle taskPlugins and build authors should attach tasks that produce distributions and other consumable artifacts to this lifecycle task.
and
archivesA standard configuration for the production artifacts of a project. This results in an
uploadArchivestask for publishing artifacts attached to thearchivesconfiguration.
Nowhere in my build script am I attaching anything to the archives configuration or assemble task, so why is myTask going to be executed?
My example is contrived, but I am seeing this in an internal project where we have several configurations that contain the outputs for polyglot projects that are depended on from a multi-project perspective like project(":some:path", "someConfig") and we want to separate the built into stages. In our actual project, we have the java plugin applied and this still happens.