Friday, 26 January 2018

4. Creating a Maven project in Eclipse

Creating the project in Eclipse


Let's create a Maven project in eclipse. Eclipse is the IDE(Integrated Development Environment) that we will be using to develop the selenium project. You can download Eclipse from www.eclipse.org. To start off, we need to create a new project and then select Maven project.


File -> New -> Project


Once 'Project' is clicked, a pop-up window appears as shown below


Once 'Next' is clicked, the archetype selection window appears. Select 'Create a simple project(skip archetype selection)


Clicking 'Next' will bring up the screen shown below. In the Group Id enter com.selenium, in the Artifact Id, enter hrdemoapp, in the Version enter 0.0.1-SNAPSHOT. Here SNAPSHOT indicates that this is a Work-in-Progress. The Packaging can be selected as jar which means that our eventual product will be packaged as a JAR file at the time of deployment. The name that is provided in the Artifact Id will be the name of the JAR file.


Once these details are entered, the 'Finish' Button will be enabled. Upon clicking the Finish button, the project gets created in Eclipse with the structure shown below. The page objects will be created in src/main/java and the test classes will get created in src/test/java. Apart from this, there is a src/main/resources for any resources like property files, Data files etc. Similar folders exist for the test resources. Also notice that a pom.xml file also gets created. POM stands for project object model. This file is used for managing dependencies, plugins etc for the project. We will get into the POM.xml file soon. We are using JDK 1.8 here. You may use other version of Java if you choose to.


In case downloads are blocked at the workplace by a corporate firewall, you can get the Jars downloaded manually. Then create File -> New -> Project -> Java -> Java Project
Once the project gets created, right click on the project and click on Build Path -> Configure Build Path

In the Properties popup, select libraries tab and then click 'Add External JARS'. Select the required JARS from the hard drive and then click ok.

No comments:

Post a Comment