Search code examples
eclipsegradleeclipse-pluginbuildship

Get information from Gradle eclipse plugin


I'm developing an Eclipse plugin. In my plugin I run a Gradle task.

The Gradle is executed when the user clicks on a button.

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.

I noticed that in Eclipse preferences under Gradle, there is an option to choose between each one of them. I want to read this configuration from my plugin. Does somebody knows how to read this configuration?

Thanks!

eclipse preferences


Solution

  • 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))
    
    ...