Hi! I am trying to write a Gradle plugin.
One of my plugin’s added tasks depends on ‘jar’ (from the java plugin). That’s because I expect to use the jar artifact(s) generated by the project, but I was also expecting to be able to use all artifacts generated by the sub-projects, but that’s not being possible because when I run my plugin’s task, Gradle only triggers ‘jar’ for the main project, not for the sub-projects.
Here’s how I declare my task:
@Override
void apply( Project project ) {
project.apply( plugin: 'osgi' )
// other stuff not relevant
project.task( dependsOn: 'jar', 'myTask' ) << closureWithTheTaskCode
}
Is there a way to tell Gradle (from my plugin, not on the user’s build file) to run ‘jar’ for all sub-projects before running my task?
Thanks!