onsdag 14 december 2011

3 different ways to convert existing web project to WTP project

1) Using Maven
If you created an application using maven you can use the folliwng command line to convert it to support Eclipse's wtp:
$ mvn eclipse:eclipse -Dwtpversion=2.0

This will create .wtpscomudules that Eclipse require to eneble WTP support.

2) Using Eclipse WTP tool
Standard Eclipse’s “.classpath” and “.project” files are created. And you will noticed a new “.setting” folder is created and inside contains “org.eclipse.wst.common.component” and “org.eclipse.wst.common.project.facet.core.xml“, both files for WTP or Faces support in Eclipse.
File : org.eclipse.wst.common.project.facet.core.xml
<faceted-project>
  <fixed facet="jst.java"/>
  <fixed facet="jst.web"/>
  <installed facet="jst.web" version="2.4"/>
  <installed facet="jst.java" version="1.4"/>
</faceted-project>
Note
Maven 2.x generated web application with JDK1.4 (see above), which is rather outdated, you may need to upgrade it to latest JDK version.
File : org.eclipse.wst.common.component
<project-modules id="moduleCoreId" project-version="2.0">
  <wb-module deploy-name="mkyongweb-core">
    <property name="context-root" value="mkyongweb-core"/>
    <wb-resource deploy-path="/" source-path="src/main/webapp"/>
    <property name="java-output-path" value="/target/classes"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>
  </wb-module>
</project-modules>


3)Import into Eclipse IDE
Now, you have everything what a Eclipse web application want, so, you
 can start import your Maven based web application into Eclipse IDE.
Steps :

 In Eclipse IDE, menu bar , File -> Import… -> General -> 
Existing Projects into Workspace -> select root directory (select 
your project folder) -> Done.

Inga kommentarer:

Skicka en kommentar