Setting up Maven in Eclipse editor
Why MAVEN?
Maven (which means accumulator of knowledge) is a build tool used to build and manage any Java-based
project. It helps us to manage the daily tasks for Java developers easily.
Maven provides simple yet effective dependency management. It uses an XML
file (POM.xml) to describe the project that we are building, the dependencies
of the software with regards to third-party modules and parts, the build order,
as well as the needed plugins. Maven downloads libraries and plugins from the
different repositories and then puts them all in a cache on your local machine
(C:\Users\\.m2).
Why Maven is used in Selenium?
While working in selenium, we
have to manage various dependencies (external JAR files) to execute our
project, such as: Selenium-Java JARS, Log4j JARS, Apache POI jars etc. We can
use MAVEN to reduce our efforts on managing these dependencies by adding them
to POM.xml file. When we restore our OS / try to execute the project in
different machine, the POM.xml file will manage and download those dependencies
to local system location as mentioned earlier and will help us to build the project.
Installing MAVEN in Eclipse
Step 1: Under
Help Menu, click on ‘Install New Software’
Step 2: Click on ‘Add’
Step 3: Enter the
data for the following text box and click on ‘Add’ button:
a.
Name – Maven
Step 4: Check on
the checkboxes and click on ‘Next’ button.
Step 5: Click on ‘Next’
button
Step 6: Accept
the license agreement and click on ‘Finish’ button.
Step 7: Please
wait for installation to finish. Once the installation is finished, eclipse
will request to restart the application. Click on ‘Restart Now’.
Creating a new MAVEN Project
Step 1: Go to
File, New and Click on ‘Other…’
Step 2: Expand Maven
from the tree, Click on ‘Maven Project’ and click on ‘Next’
Step 3: Keep
unchecked ‘Create a simple project (skip archetype selection)’ and click on ‘Next’
button
Step 4: Wait for
archetypes to load, once the data is retrieved Select ‘maven-archetype-quickstart’
under Group Id ‘org.apache.maven.archetypes’ and click on ‘Next’
Step 5: Provide a
Group Id and Artifact Id and click on ‘Finish’
Step 6: Please
wait for project to be created
Comments
Post a Comment