Wednesday 28 February 2018

Maven Project Integration with Eclipse


Step1:
>>Open cmd and check weather Maven install or not.
>> Once got the above error your system is not set up the Maven.
>> Then do the following Steps.

Step2:
>> Navigate to the below link.


>> Click on the above highlighted "apache-maven-3.5.2-bin.zip"
> Once download is completed , Extract the .zip file. and open extract the file.


>> Then open the bin folder and copy the entire path up to bin folder.


>> Like that " C:\Program Files\Maven\apache-maven-3.5.2\bin "
Step3:
>> Navigate to System properties.

* Click on Advanced system settings




* Click on Environment Variables.

                              

* Click on path and click on edit button


                                


>> Paste the maven bin path on Variable value like that.

"C:\Program Files\Maven\apache-maven-3.5.2\bin"
>> Click on ok Button
                              

>>  Click on New Button  Show in below.



                               

>> Se the variable name: MAVEN_HOME
       Variable value:: path of the maven folder (C:\Program Files\Maven\apache-maven-3.5.2)
>> Click on 'Ok' button.
                              


>> again click on 'ok'.
>> again click on 'ok'
 Step4:
>> Now again open commend and check the maven version shown in below image.


               

Create maven Project in Eclipse
Step5:
>> Open Eclipse => Navigate to file => New => Others 

               
 Step6:
>> Open Maven and click on Maven Project
>> click on Next Button
                
Step7:
>>  Click on Check box of Sample project  and click on next Button.



Step8:
>> Enter Details of the project fields like below image.
Note: Group Id:: "Company Name"
                Artifact Id:: "Project Name"

>> Click on Finish button.
               

Step9:
>> Open project and wait for up to  all components are visible.
 like below show in image.
                              

Step10:
>>JDK Setup in Eclipse.

>> Navigate to c:Drive => Program Files => Java => Select the JDK path.
like in this format.

Ex:  "  C:\Program Files\Java\jdk1.8.0_131 "

Step11:
>>  Navigate to Window => Preferences => Java.
>> Open java



   

Step12:
>> Click on Installed  JREs
                                


Step13:

>> Click on Add button



Step14:

>> Select on Standard CM
>> Click on Next

              


Step15:
>> Enter JRE home::path of JDK like that " C:\Program Files\Java\jdk1.8.0_131"

>> Click on Finish


               
Step16:
>> Select on JDK

>> Click on Apply
>> Click on Ok button


POM.xml:

Link to access pom.xml file:
Please Find the Below link we can find the Pom.xml file. 

                                                                                     OR

 You can use the following code to set the properties, Dependencies,plugins etc.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>www.testingmasters.com</groupId>
 <artifactId>VeeraMohanSelenium</artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <name>VEERA</name>
 <description>Sample Project</description>

 <properties>
  <suiteXmlFile>testng.xml</suiteXmlFile>

 </properties>

 <dependencies>

  <dependency>
   <groupId>org.testng</groupId>
   <artifactId>testng</artifactId>
   <version>6.13</version>
  </dependency>
  <!-- Adding Selenium dependency -->
  <dependency>
   <groupId>org.seleniumhq.selenium</groupId>
   <artifactId>selenium-java</artifactId>
   <version>2.53.0</version>
  </dependency>
  <!-- https://mvnrepository.com/artifact/com.beust/jcommander -->
  <dependency>
   <groupId>com.beust</groupId>
   <artifactId>jcommander</artifactId>
   <version>1.27</version>
  </dependency>


 </dependencies>

 <build>

  <plugins>

   <plugin>

    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8</version>
    <configuration>
     <compilerVersion>1.8</compilerVersion>
     <source>1.8</source>
     <target>1.8</target>
    </configuration>
   </plugin>

   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.17</version>
    <configuration>

     <suiteXmlFiles>
      <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
     </suiteXmlFiles>

    </configuration>
   </plugin>

  </plugins>

 </build>

</project>