Maven verion: 2.0.7
Eclipse Version: 3.3.0
Build id: I20070625-1500
The following is how I setup a maven web project that can be hot deployed using eclipse WTP.
1. Create maven web project
mvn archetype:create
-DgroupId=[your projects group id]
-DartifactId=[your project's artifact id]
-DarchetypeArtifactId=maven-archetype-webapp
ref
2. Create dynamic web project in eclipse
Replace maven generated WEB-INF and META_INF with eclipse generated WEB-INF and META-INF
3. Create M2_REPO variable in eclipse and point it to ~/m2/repository
4. Create src/main/java and src/main/test folder
5. Point eclipse source folder to src/main/java and src/main/test folders.
6. Delete eclipse WTP default WebContent folder.
7. Switch to navigaton view and modify org.eclipse.wst.common.component file
i.e.
<?xml version="1.0" encoding="UTF-8"?>
< project-modules id="moduleCoreId" project-version="1.5.0">
< wb-module deploy-name="MyWebApp">
< wb-resource deploy-path="/" source-path="/src/main/webapp"/>
< wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
< wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
< property name="context-root" value="MyWebApp"/>
< property name="java-output-path" value="build/classes"/>
< /wb-module>
< /project-modules>
8. Modify pom.xml file and add the following plugin configuration
< build>
< finalName>MyWebApp</finalName>
< plugins>
< plugin>
< groupId>org.apache.maven.plugins</groupId>
< artifactId>maven-eclipse-plugin</artifactId>
< configuration>
< buildoutputdirectory>src/main/webapp/WEB-INF/classes
< /buildoutputdirectory>
< downloadsources>true</downloadsources>
< /configuration>
< /plugin>
< /plugins>
< /build>
9. Add dependent libraries to the pom.xml
10. run mvn eclipse:eclipse
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment