Today i am going to post the tutorial on how to create maven project using eclipse IDE.
Here are the steps in detailed for creating maven project using the eclipse.
Required softwares mentioned below
2. Eclipse – Kepler – download J2EE IDE from here
3. Tomcat 7.0 — download from here
4. Maven — download from here
Create new dynamic project
Click Next. Click Add Folder button and add the java, resources folder under main and test etc
Once added all the folders, screen looks like below
Select Generate web.xml deployment descriptor check box and click on Finish.
Once the project generated, structure looks like below
Now convert the project in to maven mode,
Right click on the project and select Configure –> Convert to Maven Project option
Click Finish button.
This will generate the pom.xml and other required files.
Now open command prompt. Goto the project location and execute the below command
mvn eclipse:eclipse -Dwtpversion=2.0
After successful, the folder structure looks like below
Move the Webcontent folder files under src/main/webapp and delete WebContent folder.
Right Click on the webapp folder and select Build Path — make as source folder.
Right click on the pom.xml file and execute the below commands
clean compile install -U
Make sure the above two commands are executed successfully.
Now add Tomcat Server
Click Finish button.
Now to add all the Jar files, Right click on the project,select Build Path, select Libraries tab.
We will see the M2_REPO jar files. Add the tomcat Server using Add Library.
Once added, go to Order and Export tab, click on Select All option and Click OK.
Right click on the project and select Properties.
Go to the Deployment Assembly tab, click Add button – Java Build Path Entries and Click Next button.
Select all the Jars and Click Finish button and Click OK.
Right click on the Project and select properties option, goto Server tab
Select Tomcat Server option click on Apply and Click OK button.
Goto Targeted Runtimes tab
Select Tomcat Server option and Click on Apply and Click OK.
Now We are done with the environment setup.
Next Start Tomcat server and make sure the project MavenProject added to it.
Also make sure no compilation / server start up errors.
Once server started successfully, launch the web application page and unit test it.
Here are some of the useful information about Maven.
Maven folder structure — Click here
Learn Maven in 5 minutes — Click Here
Get glued to know more updates.
Have a nice day