Community
Participate
Working Groups
With the fix for bug 220371, we create the highest level of EAR that the server runtime can support. However, we would not accurately have that information until the server is created, which is done later on in the install phase, not during Assemble phase when the EAR is created. So, instead, we should try to create the EAR version that is compatible with the modules to be added to the EAR (similar to how defaulting is done in J2EE wizard when a Web project is created). Once this fix is done, then the patch for 220371 can be committed.
Jason suggested looking at NewProjectDataModelFacetWizard in org.eclipse.wst.web.ui. In the constructor, you will see how the default is loaded up using the working copy; ie. getFacetedProjectWorkingCopy().setFixedProjectFacets( this.template.getFixedProjectFacets() ); There is a method on there to set the primary runtime. I suggest you put a few breakpoints in the FacetdProjectworkingCopy and see how the presets are figured out. I don't know the exact code paths you need to replicate, but this is the general area of code you need to be looking at.
Created attachment 93495 [details] patch added getRequiredEARFacetVersions(IProject) utility function to get the correct EAR version.
Patch committed and released to HEAD as v200803261717.
mass change to add 'contributed' keyword based on bugzilla query, please correct if that's not accurate (by marking patches as obsolete and removing the 'contributed' keyword.
Verified on WTP 3.0 04/15 driver.