facebook

Converting a Java Project to a Web Project

It is now possible to configure a Java project with Web project characteristics.  Here you will learn how to convert a Java project that you already have.

This feature is available in MyEclipse.

MyEclipse is able to configure an existing Java project with Web project characteristics. This capability is useful for enabling an existing Java project that is either in exploded WAR format or that will be transitioned into an exploded WAR format post the configuration process. Common uses of this feature are to enable existing projects created by other Java EE web-oriented development tools.

  1. Right-click the Java project to be configured, and select MyEclipse>Project Facets>Install Dynamic Web Module Facet from the menu.


    Opening the Install Dynamic Web Module Facet wizard

    Note: If you receive an “Invalid Project Structure” warning, this indicates that your project’s root folder is serving as a source folder. This violates Eclipse build path restrictions that prohibit a source folder from overlapping with an output folder. A Web project output folder is always the relative folder path: <web root folder>/WEB-INF/classes.


    Invalid project structure warning

    To resolve this problem see, Invalid Web Project Structure Resolution.

  2. Select the dynamic web module version and a target runtime, and click Next.


    Selecting version and runtime

  3. Specify an existing folder that will serve as the web project’s Web Root folder, or enter the name for a new web root folder. The contents of the web root folder must be structured as an exploded WAR file, i.e., it contains the <web root>/WEB-INF/classes and <web root>/WEB-INF/lib subfolders. The configuration process creates this structure if it does not already exist.


    Defining the web root folder

  4. Select the Create web.xml checkbox to create this deployment descriptor. This option is ignored if the project already contains a web.xml file in an existing WEB-INF folder.
  5. Click Finish to complete the configuration.

Upon completion, the MyEclipse web development tools should function properly for web documents located in the project’s web root folder.