I'm trying to write my own gradle plugin in Kotlin. It executes fine, but I want the build
task to be run with --refresh-dependencies
argument, such that the final outcome is the equivalent of
./gradlew build --refresh-dependencies
./gradlew publishToMavenLocal
Here is my custom plugin:
class PublishManager : Plugin<Project> {
override fun apply(target: Project) {
target.task("syncAndPublish") {
doLast {}
}.dependsOn("publishToMavenLocal")
.dependsOn("build") // HOW TO ADD -refresh-dependencies HERE?
}
}
Try this in your plugin: