How To Import Maven Project In Eclipse For Selenium Test

We have created new project with name "MavenProject" from command prompt during previous post. Now we needs to Import maven project In eclipse and then we can create and run selenium test In It. We will go step by step to Import project In eclipse as bellow.

Step 1 : Make "MavenProject" compatible to Import In eclipse
Any project needs .classpath and .project files under project folder to Import It In eclipse. If you noticed, our maven project do not have any such file. To create both these files, You need to set project folder as working directory In command prompt and then run mvn eclipse:eclipse command as bellow.


It will create .classpath and .project files under project folder as bellow.


Now your project Is compatible to Import In Eclipse.

Step 2: Open Eclipse and Import Project
Steps to Import maven project In eclipse.

Right click on project explorer and go to Import -> Import. It will open Import popup.


Explore General folder and select Existing Project into Workspace from It as bellow and then click on Next button.


On next screen, click on Browse button. It will open Browse For Folder popup. Select MavenProject project folder from It and click on OK button.


It will set root directory to project folder path and so project In grid as bellow.


Click on Finish button. It will Import maven project In Eclipse. Project structure will looks like bellow In eclipse.



Now maven project Is Imported In eclipse successfully. Developers use main folder to write code. We will use only test folder to create our selenium webdriver example test. Next post will describe you how to create and run selenium test In maven project.

4 comments:

  1. Thanks again for this tutorial :)

    ReplyDelete
  2. Great tutorial thanks. Could you show how to export a project and then import to a different windows PC?

    ReplyDelete
    Replies
    1. just export to a file system, there is an option in eclipse.... and then later import as explained above in the post.

      Delete
  3. Thanks for the tutorial. Can you explain how to export a Maven project and import to a different Windows PC?

    ReplyDelete