Eclipse wtp plugin does not overwrite default facets

Hi,

Just trying out 2.3-rc-1.

I’ve noticed some problems generating eclipse facets using eclipse-wtp plugin. In general the problem is that plugin’s default facets(for ear or war plugins) are added to xml file even if i add my own version of facet.

With war plugin:

apply plugin:"war"
apply plugin:"eclipse-wtp"
  eclipse.wtp.facet {
    facet name: "jst.java", version:"1.5"
    facet name: "jst.web", version: "2.4"
}

generates duplicate jst.java facet

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
 <fixed facet="jst.java"/>
 <fixed facet="jst.web"/>
 <installed facet="jst.web" version="2.4"/>
 <installed facet="jst.java" version="6.0"/>
 <installed facet="jst.java" version="1.5"/>
</faceted-project>

and with ear plugin:

apply plugin:"ear"
apply plugin:"eclipse-wtp"
  eclipse.wtp.facet {
 facet name: "jst.ear", version:"1.4"
}

generates duplicate jst.ear facet:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
 <fixed facet="jst.ear"/>
 <installed facet="jst.ear" version="5.0"/>
 <installed facet="jst.ear" version="1.4"/>
</faceted-project>

current workaround is to delete facet manually:

eclipse.wtp.facet {
    facet name: "jst.ear", version: "1.4"
    file{
        whenMerged{ WtpFacet wtpFacet->
            def List<Facet> facets = wtpFacet.facets;
              facets.remove(new Facet("jst.ear","5.0"))
          }
    }
}

Try setting ‘facets’ to an empty list before specifying your facets.

eclipse.wtp.facet {

facets = []

// add facets here

}