As far as I know there is no feature to import these settings automatically in Gradle. However, I could think about building something manually by providing a defaultJdtPrefs.properties
file which contains all the settings for org.eclipse.jdt.core.prefs
. For creating org.eclipse.jdt.ui.prefs
while executing gradle eclipse
you could use the following:
tasks.cleanEclipse.doLast {
delete("${project.projectDir}/.settings/org.eclipse.jdt.ui.prefs")
}
tasks.eclipse.doLast {
File saveActionPrefs = file("${project.projectDir}/.settings/org.eclipse.jdt.ui.prefs")
if (saveActionPrefs.exists()) {
logger.warn("UI preferences already exist and will not be overridden. Use task 'cleanEclipse' first.")
} else {
saveActionPrefs.append('''
eclipse.preferences.version=1
<<HERE COMES YOUR CONTENT>>
'''. stripIndent())
}
}
With this solution you could even the above provided EPF file containing the your preferences to create the org.eclipse.jdt.ui.prefs
file using any of the Groovy build-in XML parsers ;-)
I know this is not the best solution because you have to add these things to every project (or via a custom Gradle plugin), though, the only solution I can currently think of.