I have following build script. which tries to add the JavaScript facet to a eclipse web project. But the resulting project only contains the JavaScript facet. The default Java and Java Web facets are missing. This is contrary to my understanding of the EclipseWtpFacet documentation, which says that the facet method adds a facet.
But the question is, what should the default behavior are? The advantage of not adding the default facets is that you don’t have to delete unwanted facets. The obvious disadvantage is that you also have to add the default facets again if you really want to add some new …
@Gradle: I would suggest adding a new method which adds the default facets (from the convention container), so everybody can choose what he/she really want? What do you mean? I think I could fix that providing a pull request!
I don’t use Eclipse anymore, so I don’t care much right now.
Still I believe that most configuration blocks add to or transform existing (default) configuration, and don’t reset it, i.e. methods or blocks add, assignments overwrite.
Therefore I think the better solution would be a clear method within the facet block to make the use case of removing the default facets possible, and implement the documented behavior. It feels more natural and gradle-like than to be surprised with a “destructive” behavior.
Re facet customization behavior: Andreas’ proposal sounds good to me. We can add a method to populate list of facets with default content (same as content defined by convention mapping). It means it is possible to achieve state with new facets and with or without default facets. And existing build scripts will not change their behavior this way. I like it more than introducing a method to remove content added as default.