In the build.gradle, I have a task to publish the zip file like this. And now I want to put into the custom plugin. But I have no idea how to set the default action for this task.
apply plugin:“maven-publish”;
//to package the file
task packageFile(type: Zip) {
description “Package the source into zip file”
from “src”
}
publishing {
publications {
maven(MavenPublication) {
artifact packageFile
}
}
}
What should I write inside my groovyPlugin? I want to use as a default task, so no need to copy so many times.
Thanks.
@Override
public void apply(Project project) {
project.plugins.apply(“maven-publish”);
project.task[“publishing”].artifact = …?
}