[GRADLE-2186] Faceted eclipse wtp projects without war/ear plugin applied Created: 20/Mar/12  Updated: 03/Dec/14  Resolved: 03/Dec/14

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-7
Fix Version/s: 2.3-rc-1

Type: Improvement
Reporter: Georg Fleischer Assignee: Radim Kubacki
Resolution: Fixed Votes: 5

Issue Links:
Duplicated by GRADLE-2362 eclipse-wtp should be supported on no... Resolved


We are developing JEE applications with gradle and work with the 'ear' and the 'war' plugin.
In order to develop those applications we use eclipse.
For that we generate all of our eclipse project files with gradle.

What whe want to achieve:
We want to have a project module that appears inside eclipse as a plain EJB module.
This can be accomplished by adding facet (name: "jst.ejb", version: "3.0") to the eclipse
facets configuration.

It is not possible to add an additional facet to the project module without adding the
war or ear plugin. If we add the war or ear plugin, adding the additional facet works.
But this is not the desired behaviour. It makes no sense to apply a war or ear plugin to
an ejb project.

Possible Solution:
To keep things flexible it would be great to apply the eclipse-wtp plugin to a project
without any other mandatory combination of plugins (e.g. ear or war).

This code should work without applying the 'war' plugin:

eclipse {
wtp {

{ //you can add some extra wtp facets; mandatory keys: 'name', 'version': facet name: 'someCoolFacet', version: '1.3' }


Comment by Georg Fleischer [ 21/Mar/12 ]

This can be realized by modifying the class org.gradle.plugins.ide.eclipse.EclipseWtpPlugin.
Currently the Tasks GenerateEclipseWtpComponent and GenerateEclipseWtpFacet are only applied if the war or ear plugin are used.
There could be a "basic" version of the task configuration which generates the XML files without any content and dependent on the chosen plugins these tasks are configured with the additional compoent and facet informatione. This would be very flexible to control the content of these files.

This would also eliminate duplicated configuration code which now exists in the class (assignment of "description", "inputFile", "outputFile", "eclipseWtpModel.facet")

Comment by Szczepan Faber [ 14/May/12 ]

I like those ideas. I think we should aim for:

  1. the eclipse-wtp always adds wtp related tasks (and potentially, a DSL extension, too)
  2. the tasks are skipped if no facet / wtp configuration is found
  3. the ear and war plugin configure the facets / wtp in a way the tasks have meta to generate (i.e. they are not skipped).
Comment by Roman [ 27/Dec/13 ]

Do you have any visibility what version will include this fix?

Comment by Thorsten Möller [ 28/Apr/14 ]

This issue is related to http://issues.gradle.org/browse/GRADLE-2221, if not a duplicate.

Comment by Andreas Schmid [ 19/Oct/14 ]

Hi Georg Fleischer et. al.,
I am currently working on a pull requests containing some improvements for the "eclipse-wtp" plugin, especially on two things:

  • allowing any project which has applied the "java" to configure eclipse.wtp.component and eclipse.wtp.facet
  • adjusting the eclipse-wtp defaults for a "java" project

As I just know how a "war" dependent project likes like, can you please post and example of ".settings/org.eclipse.wst.common.component" and ".settings/org.eclipse.wst.common.project.facet.core.xml" for and "ear" dependent project? This would help me a lot, otherwise I can only guess and either add the above mentioned facet name: "jst.ejb", version: "3.0", or just facet name: "jst.utility", version: "1.0" and you can manually add all you need, additionally.

Here is the discussion on gradle-dev mailing list: http://gradle.1045684.n5.nabble.com/Default-configurations-for-Eclipse-WTP-plugin-on-dependent-jar-td5713163.html

Comment by Radim Kubacki [ 03/Nov/14 ]

I applied the patch from Andreas Schmid (https://github.com/gradle/gradle/pull/344 and https://github.com/gradle/gradle/pull/345). Is there anything more we want to do before closing this bug?

Comment by Andreas Schmid [ 03/Nov/14 ]

Hi Radim Kubacki,
I have prepared some more pull requests (but not opened yet as they are not 100% ready yet) to really solve this bug such that applying the "eclipse-wtp" plugin to a pure "java" project let you also change

eclipse {
  wtp {
    component { ... }
    facet { ... }

as IMHO suggested in this bug report. Maybe I can finish this until the end of this week (even if it will be a bigger change ...). Would that be ok?

Comment by Radim Kubacki [ 03/Nov/14 ]

Take your time. It will be going to 2.3 release anyway like the other changes. Thanks for that work.

Comment by Radim Kubacki [ 03/Dec/14 ]

Covered now thanks to Andreas Schmid's contribution. Thanks.

Comment by Andreas Schmid [ 03/Dec/14 ]

Hi Radim Kubacki,
also GRADLE-1422, GRADLE-2221, GRADLE-2362 and http://forums.gradle.org/gradle/topics/additional_eclipse_wtp_facet_overwrites_default_facets should be solved by my commits. I am not sure whether GRADLE-2834 is fixed as well as I have got no answer on that.

Generated at Wed Jun 30 12:15:03 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.