Hi.
I just gave a training about Java web development, using eclipse as an IDE, servlet 3.0, and gradle to create the project.
I had a problem though: gradle generates a jst-web facet with version 2.4. This makes eclipse continually generate an unwanted web.xml deployment descriptor (no web.xml is necessary with servlet 3.0), and with the wrong webapp version of course (2.4 instead of 3.0). As a result, the application isn’t functional anymore until the facet version is manually edited in the eclipse configuration file. And if the project is regenerated (because a dependency is added, for example), the configuration is lost.
I managed to customize the version with the following code:
eclipse {
wtp {
facet {
file {
whenMerged { wtpFacet ->
def installedJstFacet = wtpFacet.facets.find { facet ->
facet.name == 'jst.web' && facet.type == org.gradle.plugins.ide.eclipse.model.Facet.FacetType.installed
}
installedJstFacet.version = '3.0'
}
}
}
}
}
But I find it too complex to figure out, for something that should always be configured (the eclipse wizard for web projects asks which version the project should have).
I have a fix ready to be submitted as a pull request, which consists in adding a property webVersion in the DSL. The configuration would then become:
eclipse {
wtp {
facet {
webVersion = '3.0'
}
}
}
Please tell me what you think about this. Should I submit a pull request? Is “webVersion” the appropriate name? Maybe “webAppVersion”?