go to  ForumEasy.com   
JavaPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » Java Deploying » Maven -- Import Java WebApp project into Eclipse IDE WTP
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: Maven -- Import Java WebApp project into Eclipse IDE WTP
Alex_Raj
member
offline   
 
posts: 99
joined: 05/16/2006
from: San Jose, CA
  posted on: 03/29/2012 01:33:11 PM    Edit  |   Quote  |   Report 
Maven -- Import Java WebApp project into Eclipse IDE WTP
To convert Java web application into Eclipse IDE with the support of WTP, type in the command:
mvn eclipse:eclipse -Dwtpversion=2.0


Output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyWebProject Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.9:eclipse (default-cli) @ MyWebProject >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.9:eclipse (default-cli) @ MyWebProject <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.9:eclipse (default-cli) @ MyWebProject ---
[INFO] Adding support for WTP version 2.0.
[INFO] Using Eclipse Workspace: null
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAIN
ER
[INFO] Not writing settings - defaults suffice
[INFO] Wrote Eclipse project for "MyWebProject" to C:\HelloWorld\Maven\MyFirstWe
bProject\MyWebProject.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.254s
[INFO] Finished at: Thu Mar 28 23:19:49 PDT 2012
[INFO] Final Memory: 7M/154M
[INFO] ------------------------------------------------------------------------

 Profile | Reply Points Earned: 0
Alex_Raj
member
offline   
 
posts: 99
joined: 05/16/2006
from: San Jose, CA
  posted on: 03/29/2012 01:42:24 PM    Edit  |   Quote  |   Report 
What have been done?
Apart from the two files:
  • .project

  • .classpath

  • which are for the standard Eclipse IDE project, a new folder has been created:
         [+] -- .setting
              [-] -- org.eclipse.wst.common.component
              [-] -- org.eclipse.wst.common.project.facet.core.xml
    


    org.eclipse.wst.common.component
    <?xml version="1.0" encoding="UTF-8"?>
    <project-modules id="moduleCoreId" project-version="2.0">
      <wb-module deploy-name="MyWebProject">
        <property name="context-root" value="MyWebProject"/>
        <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>
    



    org.eclipse.wst.common.project.facet.core.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <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>
    


     Profile | Reply Points Earned: 0
    Alex_Raj
    member
    offline   
     
    posts: 99
    joined: 05/16/2006
    from: San Jose, CA
      posted on: 03/29/2012 01:45:39 PM    Edit  |   Quote  |   Report 
    Import into Eclipse IDE WTP
    Follow the same process as in the standard project:

    File -> Import… -> General -> Existing Projects into Workspace

    1)Type in your project folder in the Select root directory box: C:\HelloWorld\Maven\MyFirstWebProject\MyWebProject

    2)Check Copy projects into workspace checkbox.

    3)Click on Finish button.

     Profile | Reply Points Earned: 0
    Alex_Raj
    member
    offline   
     
    posts: 99
    joined: 05/16/2006
    from: San Jose, CA
      posted on: 03/29/2012 01:51:13 PM    Edit  |   Quote  |   Report 
    Let's run it!
    Now your WebApp should be recognized by Eclipse's Server and can be added into Server's context.

    It then can be run under http://localhost:8080/MyWebProject


     Profile | Reply Points Earned: 0

     
    Powered by ForumEasy © 2003-2005, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.