从Java类调用gradle任务 [英] Call a gradle task from java class

查看:208
本文介绍了从Java类调用gradle任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从我的java类中调用Gradle任务?

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

一些团队创建了一个Gradle插件,我们只是想重用它,所以有办法从Java类中调用Gradle插件吗?

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?

推荐答案

您可以使用

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:

执行构建并收听stdout和stderr日志记录,以及 进度(例如,在 命令行).

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任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆