From the course: Cucumber Essential Training

Create a Maven project

From the course: Cucumber Essential Training

Start my 1-month free trial

Create a Maven project

- [Instructor] So now that we have all the installations done, let's go ahead and create our Cucumber project. I'll go ahead and launch Eclipse, select default workspace. And once Eclipse is up and running, I'll close the welcome screen. Click File, New, and select Other. I'm going to select Maven project, click Next, use the default workspace location, click Next, and use the quick start Maven project. This is a very simple project that we're going to use to create our Cucumber test scenarios and step definitions. Let's go ahead and click Next. For the group ID, I'm going to use LinkedIn Learning. And for the artifact ID, the name will be Cucumber Course. The default package for the objects in this project will be LinkedInLearning.CucumberCourse. Click finish to create the project. Since we are using a Maven project, it has created a nice structure for us. We already have the source files here under src/main/java and the test files under sr/test/java. Now one great thing you get with working with Maven is all the dependencies can be downloaded on the fly by using the dependencies provided in the pom or project object model.xml file. So I need the dependencies to the Cucumber jar files. Cucumber for Java is a collection of Cucumber Java archive files. And I'm going to add those dependencies now. The easiest way to do this is to go to what is known as the GitHub Java Skeleton Project. Navigate to its pom.xml file and just copy the dependencies from there. I'll copy these dependencies, go back to Eclipse, and paste the dependencies here. In fact, I'm going to override it. And I have my dependencies here. I also need a few project properties. So let's go back to the GitHub link and copy project properties. These properties are referenced in the dependencies. So let's go back here under project properties and let's add these here. And once we save this file, I have all the Cucumber dependencies available to me. There's one additional thing I need to do, when I run Maven in stand alone mode, that I need to include Maven compiler source and target to make sure we can run Maven in stand alone mode. I'm going to do that. And this going to be 1.7. And let's add the target here. I have the Maven compiler source here. I'm going to add the target. And save this file. The next thing I need to do is just format everything so it looks nice and clean. Save the file again and we are all set.

Contents