简体   繁体   English

从 Gradle eclipse 插件获取信息

[英]Get information from Gradle eclipse plugin

I'm developing an Eclipse plugin.我正在开发一个 Eclipse 插件。 In my plugin I run a Gradle task.在我的插件中,我运行 Gradle 任务。

The Gradle is executed when the user clicks on a button. Gradle 在用户单击按钮时执行。

I want to let the user to choose whether he want to use the Gradle wrapper, local Gradle installation directory or a specific Gradle version.我想让用户选择是要使用 Gradle 包装器、本地 Gradle 安装目录还是特定的 Gradle 版本。

I noticed that in Eclipse preferences under Gradle, there is an option to choose between each one of them.我注意到在 Gradle 下的 Eclipse 首选项中,有一个选项可以在每个选项之间进行选择。 I want to read this configuration from my plugin.我想从我的插件中读取这个配置。 Does somebody knows how to read this configuration?有人知道如何阅读此配置吗?

Thanks!谢谢!

日食偏好

To anyone who encounter this issue, I found the answer myself:对于遇到此问题的任何人,我自己找到了答案:

IPreferencesService service = Platform.getPreferencesService();
service.getString("org.eclipse.buildship.core", "gradle.distribution", "", null)

This returns, for example:这将返回,例如:

GRADLE_DISTRIBUTION(WRAPPER)

or

GRADLE_DISTRIBUTION(VERSION(6.4))

...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM