Modifying eclipse facets for java projects doesn't work

Hello,

I have a web application consisting of one war file which is depending on multiple java modules. In order to get the eclipse projects properly generated its required to apply the “eclipse-wtp” plugin to all modules even to the plain java ones. Otherwise the eclipse “Deployment Assembly” config doesn’t contain other java subprojects.

When changing the projects java version I have to change the version in the org.eclipse.wst.common.project.facet.core.xml file as well.

Unfortunately I can do this only for the war module.

For modules that have the “eclipse-wtp” plugin but not the “war” plugin applied (those are all java submodules) the code doesn’t work. the org.eclipse.wst.common.project.facet.core.xml file is generated but I cannot configure it the same way.

It fails with:

Cannot get property ‘file’ on null object

The file object nor other objects in the facet context is or are available. David

apply plugin: 'java'
  //apply plugin: 'war'
//after remove comments it works properly
  apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
  eclipse.wtp.facet.file.withXml { provider ->
    provider.asNode().installed.find { it.@facet == 'jst.java' }.@version = '1.6'
}