DEV-NOTES|Gradle: Reading Eclipses codeformatter xml file

This little code snippet transforms the code formatter XML description file into a properties structure which could be applied to the JDT properties later on.

<br />
def initializeFormatter() {<br />
  def formatterDefinitions = new XmlSlurper.parse(&quot;$rootDir/misc/codeformatter.xml&quot;)<br />
  assert formatterDefinitions instanceof GPathResult</p>
<p>  def Properties props = new Properties()</p>
<p>  formatterDefinitions.&#039;**&#039;.findAll{ node -&gt;<br />
    node.name() == &#039;setting&#039;<br />
  }*.each { n -&gt;<br />
    props.put(n.@id.text(), n.@value.text()<br />
  }</p>
<p>  return props<br />
}<br />