IBM Support

What is new in version 7.0 (Eclipse v3.2/WTP v1.5+) J2EE Projects: Project Facets, .settings folder and Builders

Question & Answer


Question

What are the J2EE Project changes when an IBM Rational Application Developer v6.0 or WebSphere Studio Application Developer v5.1.2 project is migrated to Rational Application Developer v7.0?

Cause

The J2EE Project structure, properties and usage has changed significantly in Rational Application Developer v7.0 compared to version 6.0.

Answer



  1. EAR Library and Web Library classpath containers
  2. Project Facets
  3. Builders and .settings metadata



Rational Application Developer v7.0 (Eclipse 3.2.x) J2EE tools are based on the open source Eclipse Web Tools Project (WTP) v1.5+. Eclipse WTP introduces some new acronyms: Eclipse Web Standard Tools (WST) and J2EE Standard Tools (JST), in addition to the well known Eclipse Java Development Tools (JDT). These acronyms are commonly used in the path names for project facets,builder, natures and file names in .settings folder file, all of which will be discussed in this technote.


EAR Library and Web Library classpath containers:

A good start with what is new would be to first look at a more complex change such as EAR Library and Web Library classpath containers and their use in builds (in addition to runtime). The existing technote:
J2EE classpath Container Preferences with Java Build Path and J2EE Module Dependencies Properties ,
,under the Related information section explains this in depth.



Project Facets:

Another significant change is the Eclipse/WTP J2EE project property: Project Facets . Facets define characteristics and requirements for J2EE projects. They are "units of functionality". A facet represents a unit of functionality in a WTP project. Project facets are most frequently used for adding natures, builders, classpath entries, and resources to a project. For example, they identify the type of J2EE module, Java version and other optional WTP J2EE version and vendor J2EE server functional extensions associated with a project. Basically you can now add capabilities to J2EE projects. An example in the open source Eclipse world, you could add: Struts, JSF, EJB3 Persistence, Hibernate and JSTL capabilities, depending on your Eclipse and WTP version combinations/prerequisites.

References:

Rational Application Developer v7.0 Help:

- Project Facets
- Adding a facet to a J2EE project
- Specifying target servers for J2EE projects

Eclipse 3.2 Help:

- Adding a facet to a J2EE project
- Specifying target servers for J2EE projects

The above Eclipse references, server to shows these are new open source Eclipse/WTP features and not unique to Rational Application Developer v7.0.

For plug-in developer the following WTP References may be of interest:

- Faceted Project Framework
- Extending WTP Using Project Facets
- (Historical Interest) WTP 1.0 Project Facets

Right click on a J2EE Project > Properties > Project Facets.

Two very important Facets are WebSphere {projectType} (Extended) or WebSphere {projectType} (Co-existence). In particular without WebSphere {Application | Web | EJB} (Extended) being set, you will not see the WebSphere server extensions in the J2EE Deployment Descriptors (DD(s)). The version of the server vendor extensions are connected to the server Targeted Runtime property. As in the version of a WebSphere Application Server (WAS) being v5.1,v6.0 or v6.1.
If a project/module uses the WebSphere Extended facets, it can only be published/run on a WAS server. The Co-existence is the required facet to publish/run on a WAS server. If a project only used the Co-existence facet, it can be published/run on servers other than WAS, like a Tomcat server. However, other type of Application servers might have their own special requirements for facets too

Facets can be added or removed using the Add/Remove Project Facets... button, as shown in this
Project Facets "default" properties screen shot for a new Dynamic Wed Project with Targeted Runtimes set to WAS v6.1:





Also, Targeted Runtime can be change in this wizard when using the Add/Remove Project Facets... button.

Refer to this Rational Application Developer v7.0 Help item for details:
- Modifying the target runtime settings of a project to a WebSphere Application Server


In particular on the Project Facets page under Add/Remove Project Facets... , notice the [...] selection, associated with some facets. When selected it allows you to change the Facet version, whether its a J2EE specification version or a vendor server version or Java version.

Note: In Rational Application Developer v7.0/Eclipse 3.2.x-WTP 1.5.x when the Targeted Runtime (such as the WAS server version runtime) property is changed the Facet versions are not changed. For example when changing the Targeted Runtime for WAS v6.0 to v6.1. As of Rational Application Developer v7.5 and later, this has been changed.

In the case of EJB or Web projects , the Add WebSphere XDoclet support facet is v6.1 regardless of the Targeted Runtimes being WAS v6.0 or v6.1. The actual version on the facet does not mean that it's for WAS v6.1 only - it's WAS-version independent. The default value was arbitrarily set to '6.1'.
You will see this facet being added and enabled (automatically) during migration from Rational Application Developer v6.0 if the .project file in v6.0 contained the com.ibm.ws.rapiddeploy.annotations.core.AnnotationsBuilder builder (for example it was an annotated project). In Rational Application Developer v7.x this facet is used to enable/disable this functionality rather than builders. When you choose to add The WebSphere XDoclet support facet, the Annotation Builder (com.ibm.ws.rapiddeploy.annotations.core.AnnotationBuilder ) will be added to the project's Builders property. It is not recommended that you directly uncheck this Builder property, as it contradicts the Facet. Builder are discussed in the next section. An example Add/Remove Project Facets screenshot for an EJB Project with XDoclet selected:





Builders and .settings metadata:

There are new Eclipse WTP builders replacing the Rational Application Developer v6 IBM WTP builders in the project: property: Builders ( == metadata file .project). For example in the case of a migrated Rational Application Developer v6.0 J2EE project there will be builder not found messages: Missing Builder(...), in the project properties. Example of the Builders property for a migrated Rational Application Developer v6.0 dynamic web project.



These Rational Application Developer v6 "Missing Builder" messages are harmless, and these Rational Application Developer v6.0 builders are kept in the.project file for backward compatibility purposes.
However, if you try to uncheck any builders, you will get this warning:



This is very much in-line with the previous discussion of Project Facets, and can have consequences. In particular if the builder is associated with a particular facet (e.g. Add WebSphere XDoclet support )

The Rational Application Developer v7/Eclipse WTP Builders in the .project file are prefixed with: org.eclipse.wst.*. For example: org.eclipse.wst.validation.validationbuilder , corresponding to the Validation Builder in the above screenshot, replaces the "missing" Rational Application Developer v6.0 : com.ibm.etools.validation.validationbuilder . At the same time, some builders such as the JSP Compilation Builder ( == com.ibm.etools.webtools.validation.jsp.jspcompilationbuilder), represent IBM added functionality. In Rational Application Developer v6.0 that builder was named: com.ibm.etools.webtools.additions.jspcompilationbuilder. A WTP/J2EE .project file will also have WTP related project natures prefixed with org.eclipse.wst.common.* and the nature org.eclipse.jem.workbench.JavaEMFNature. Have a look at .project for different project types and get familiar with them.

In addition to the metadata files: .project and .classpath there is now a .settings folder, replacing Rational Application Developer v6 metadata files such as .j2ee, .websettings and .runtime. The Rational Application Developer v6 j2ee related metadata files will only remain for backward compatibility purposes.

Reference:
Rational Application Developer V70 Help: Enterprise application projects
Eclipse 3.2 Help: Enterprise application projects

The .settings folder contains these four default files for a J2EE EJB or Web project:

- org.eclipse.jdt.core.prefs (for example: jdt compiler preferences)
- org.eclipse.jst.common.project.facet.core.prefs ( e.g. server runtime and server jre container preferences and j2ee facets)
- org.eclipse.wst.common.component (e.g. java-output-path, source paths, links to external content (e.g. external jars))
- org.eclipse.wst.common.project.facet.core.xml (literally the core j2ee facets, j2ee spec versions, and server runtime)
,
in addition to other workspace preference specific settings. The best way to get familiar with these files is just to look at their contents.

Acronyms: Eclipse Web Standard Tools (WST), J2EE Standard Tools (JST) and Java Development Tools (JDT).

An EAR project will only have the last two org.eclipse.wst.commmon.* files.
A Java Utility Project associated with an EAR will also have a .settings folder similar to any other J2EE project, and will have an additional org.eclipse.jdt.ui.prefs file. An EJB project will have an additional com.ibm.etools.ejbdeploy.prefs file in its .settings folder reflecting the preferences on the EJB Deployment project property, and the equivalent synchronized Rational Application Developer v6 .webspheredeploy file for backwards compatibility.

TIP: if you are uncertain what should be in a .project file or .settings folder-file for a Rational Application Developer v7 Eclipse/WTP/J2EE project or what facets the project should have, in particular a project migrated from Rational Application Developer v6, create new empty J2EE projects with the same Targeted Runtime and compare.

J2EE Migration Validation:

Under the Related Information section refer to the tool documented under:
Rational Application Developer v7.0 J2EE Migration Validation Tool.

Other Useful J2EE Tooling technotes:

Under the Related Information section refer to:
  • Rational Application Developer Web service code generation and deploy information
  • EJBDeploy generation and deletion of stubs, ties and generated deploy code
  • Best practices: derived resources not checked in


[{"Product":{"code":"SSRTLW","label":"Rational Application Developer for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Eclipse","Platform":[{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"Version":"7.0;7.0.0.1;7.0.0.2;7.0.0.3;7.0.0.4;7.0.0.5;7.0.0.6;7.0.0.7;7.0.0.8;7.0.0.9;7.5","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21313092