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 |
|
|
|
|
|
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] ------------------------------------------------------------------------
|
|
|
|
|
|
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
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>
|
|
|
|
|
|
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
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.
|
|
|
|
|
|
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
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
|
|
|
|
|
|
|