www.rodneybeede.com "I would love to change the world, but they won't give me the source code" - unknown
 Navigation

Maven 2 project as Eclipse Dynamic Web Project - Last Modified 2011-03-10 02:37 UTC - Created 2009-01-29 21:48 UTC

I used:

Creating the project

  1. mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
  2. Project is created

Create the Eclipse project

  1. Change into the project folder
  2. Modify the pom.xml with:
    1. under <build> <plugins>
      			<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-eclipse-plugin</artifactId>
      				<configuration>
      					<downloadSources>true</downloadSources>
      					<downloadJavadocs>true</downloadJavadocs>
      					<wtpversion>2.0</wtpversion>
      				</configuration>
      			</plugin>
      
    2. Or do mvn eclipse:eclipse -Dwtpversion=2.0
  3. mvn eclipse:eclipse
  4. Import the project in Eclipse with "Existing Projects into Workspace"

Sample pom.xml

http://code.google.com/p/distributed-wpa-cracking/source/browse/trunk/src/distributed-wpa-cracking-master/pom.xml

Get it to actually run

Next we must modify some variables in Eclipse in order to get it to actually run the project.

  1. Window menu, Preferences
  2. Server, Runtime Environments
  3. Add...
  4. Pick your web container server
  5. Next to follow setup then Finish
  6. Java, Build Path, Classpath Variables
  7. New...
  8. Name (case sensitive) of M2_REPO
  9. Path of C:/Users/youruser/.m2/repository
  10. OK to save
  11. Say yes to the full rebuild
  12. Run/Debug, String Substitution
  13. New...
  14. Name (case sensitive) of M2_REPO
  15. Value of %USERPROFILE%\.m2\repository
  16. OK to save
  17. Right click on your project in the Project Explorer
  18. Run As
  19. Run on Server
  20. Pick your server and run your app