I used:
- Maven 2.2.1
- Java 1.6.0_22
- Eclipse IDE for Java EE Developers, Helios SR1, 3.6.1 (Build id: 20100917-0705)
Creating the project
- mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
- Project is created
Create the Eclipse project
- Change into the project folder
- Modify the pom.xml with:
- 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>
- Or do mvn eclipse:eclipse -Dwtpversion=2.0
- mvn eclipse:eclipse
- 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.
- Window menu, Preferences
- Server, Runtime Environments
- Add...
- Pick your web container server
- Next to follow setup then Finish
- Java, Build Path, Classpath Variables
- New...
- Name (case sensitive) of M2_REPO
- Path of C:/Users/youruser/.m2/repository
- OK to save
- Say yes to the full rebuild
- Run/Debug, String Substitution
- New...
- Name (case sensitive) of M2_REPO
- Value of %USERPROFILE%\.m2\repository
- OK to save
- Right click on your project in the Project Explorer
- Run As
- Run on Server
- Pick your server and run your app