How to use Maven to create a Dynamic Web Project in Eclipse?
The Maven’s command to convert a Java project to support Eclipse IDE.
mvn eclipse:eclipse
The Maven’s command to create a Dynamic Web Project to support Eclipse IDE.
mvn eclipse:eclipse -Dwtpversion=1.5
Make sure the pom.xml, packaging is “war”, else the “-Dwtpversion” command will fail.
<project ...> <packaging>war</packaging> ... </project>
P.S If you hit Unsupported WTP version: 1.5. This plugin currently supports only the following versions: 1.0 R7 error, please visit solution here
P.S If you want to convert existing Java project to a web project in Eclipse, you can convert it by modify the .project file – How to convert Java Project to Web Project in Eclipse
Reference
More about maven eclipse:eclipse command, please visit
http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html
More about maven -Dwtpversion=1.5 command, please visit
http://maven.apache.org/plugins/maven-eclipse-plugin/wtp.html
- Java Core Technology - Java RegEx, Java XML, Java I/O, Java Misc
- J2EE Frameworks - Hibernate, Spring 2.5, Spring MVC, Struts 1.x, Struts 2.x
- Build Tools - Maven, Archiva
- Unit Test - jUnit, TestNG
- Client Scripts - jQuery
I think “mvn eclipse:eclipse -Dwtpversion=1.5″ is pretty outdated.
I found that the best way to work with Eclipse and Maven2 is to use the Eclipse’s m2eclipse plugin. http://m2eclipse.sonatype.org
See section on “Working With Eclipse and Dynamic Web Project” on this wiki:
http://code.google.com/p/jbosstown/wiki/GettingStartedWithMaven#Working_With_Eclipse_and_Dynamic_Web_Project
[...] Check here for detail about how to use Maven to create a Dynamic Web Project in Eclipse. [...]
Nice tutorials, I was wondering if you have some nice tutrial on Webservices.
thanks for the suggestion, will write some web services in future
Very useful info!
Any idea why generated classpath in the .classpath file does not include “src/main/java” and “src/test/java”?
In other words, it seems like the generated .classpath file does not include the 2 lines below:
Maven should be include those folders in Eclipse project .classpath, if your folder is follow Maven’s folder structure, Would you mind yo send me your project, in order to further study on it.