Call a gradle task from java class

2019-07-22 04:35发布

问题:

Is it possible to invoke a Gradle task from my java class?

Some team has created a Gradle plugin we just want to reuse it so is there a way to invoke Gradle plugin from Java class?

回答1:

You can probably do it using the Gradle Tooling API that allows you to embed Gradle into your own custom software. Among the features offered by this API is the ability to:

Execute a build and listen to stdout and stderr logging and progress (e.g. the stuff shown in the 'status bar' when you run on the command line).



标签: java gradle