RSS

Steps to create Maven project using eclipse

16 Nov

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

1.JDK 1.6

2. Eclipse – Kepler – download J2EE IDE from here

3. Tomcat 7.0 — download from here

4. Maven — download from here

Create new dynamic project

1

Click Next. Click Add Folder button and add the java, resources folder under main and test etc

2

 

 

Once added all the folders, screen looks  like below

3

 

Click Next

4

Select Generate web.xml deployment descriptor check box and click on Finish.

Once the project generated, structure looks like  below

5

Now convert the project in to maven mode,

Right click on the project and select Configure –> Convert to Maven Project option

6

 

 

7

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

9

After successful, the folder structure looks like below

8

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.

10

Right click on the pom.xml file and execute the below commands

clean compile install -U

eclipse:eclipse

Make sure the above two commands are executed successfully.

Now add Tomcat Server

12 13

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.

11

Select all the Jars and Click Finish button and Click OK.

Right click on the Project and select properties option, goto Server tab

14

Select Tomcat Server option click on Apply and Click OK button.

Goto Targeted Runtimes tab

16

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

Happy Learning!.

Get glued to know more updates.

Have a nice day

Advertisements
 
Leave a comment

Posted by on November 16, 2014 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: