Build Tool

Selenium maven build for Continuous Integration-CI

In previous post we have discussed Maven Integration with Selenium through Eclipse , Today we will discuss integrate selenium maven build and how to create maven build for continuous integration . Check Jenkins section to know more about CI.

To create maven build we should have maven installed in our machine  so let us start setting up maven.

 

Note- You can check Youtube video for the which we are going to cover now

 

Youtube video for the same

 

Steps for selenium maven build creation

 

Module 1- Install Maven in local machine.

1- Navigate to Maven official site and download stable version of Maven.

Maven Download- https://maven.apache.org/download.cgi

selenium maven build

integrate selenium with maven

2 –  Unzip the download file and Check unzip folder – in our case folder name- apache-maven-3.3.1

 

selenium maven build

integrate selenium with maven

3-  This is maven home directory and now we have to set path for the same

selenium maven build

integrate selenium with maven

4-     To set path variable- Right Click on my computer and Select property.

 

selenium maven build

integrate selenium with maven

5-   Now we need to set path variable also for System variable.

Note- Please do not touch other variable, Go to last point use ; and then enter path till bin folder.

 

selenium maven build

6-  Click on save and apply.  You can verify now that Maven is installed or not.

Open command prompt and type

mvn -version

7-  If Maven is installed properly then you will get Maven version and Java version on Console.

selenium maven build

 

Module 2- Create a maven project and create at least one test case.

Please refer below post to create Maven project  for Selenium in Eclipse.

https://vistasadprojects.com/mukeshotwani-blogs-v2/maven-integration-with-selenium/

In my case I have created 1 sample test case and created testng.xml file to execute test case.

Click on POM.xml file and make the below changes

 

POM.XML for Selenium maven build

 

<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>com.automation.maven</groupId>
<artifactId>com.automation.maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Create Maven build</name>
<description>Create Maven build</description>

<!-- Change from here -->

<packaging>jar</packaging>

<properties>
<suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile>

</properties>

<dependencies>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
</dependency>
<!-- Adding Selenium dependency -->
<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-java</artifactId>
 <version>2.47.1</version>
</dependency> 

</dependencies>

<build>

<plugins>
 
<plugin>

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<source>1.6</source>
<target>1.6</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>

 

My project structure after all the changes.

create POMxml file

 

 

 

 

 

 

 

 

Once all set you can execute pom.xml. Right click on pom.xml and run as maven test.

integrate selenium with maven

Now its time to enjoy because our build is success. Check below screenshot

integrate selenium with maven

Reports- You can check default reports which is created and you can see another surfire reports as well.

You can also create XSLT Reports with Maven.

integrate selenium with maven

We can also configure Maven with Jenkins and we can run our build periodically.

Hope you like above post. Please comment below if you are getting any issue.

Please share with your friends if you found this article is useful.

Keep visiting. Have a nice day 🙂

Like Facebook Page for more updates-Learn-Automation facebook page

Join Selenium Group for discussion and queries- Learn-Automation group

 

author-avatar

About Mukesh Otwani

I am Mukesh Otwani working professional in a beautiful city Bangalore India. I completed by BE from RGPV university Bhopal. I have passion towards automation testing since couple of years I started with Selenium then I got chance to work with other tools like Maven, Ant, Git, GitHub, Jenkins, Sikuli, Selenium Builder etc.

46 thoughts on “Selenium maven build for Continuous Integration-CI

  1. Joseph Mondal says:

    Mukesh you are awesome. You are the most expert for the automaton. How can you remember all these. it is astounded. I am proud of you, God bless you……….

    1. Thanks buddy…:)

      People like you are inspiration behind all my efforts…Hope to keep all of you with latest informations…

  2. chiranjeevi says:

    Hello good morning mukesh…thanks for your selenium knowledge sharing…really great work

    I integrate maven with eclipse and running fine..but unable to show surefire

  3. prashant says:

    Hi mukesh
    I am getting this Error

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project LearnMevenAutomation: Compilation failure
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [ERROR] -> [Help 1]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

    1. Hi Prashant,

      Please go to your Execution environment and check whether it is pointing to jdk or jre in local machine

      1. prashant says:

        Thanks,
        Its resolved nw
        actually the problem was some path related
        Thanks u for your help and ur helpful blogs.

        1. Hi Prashant,

          I am glad to see your reply.

  4. Aadesh Raj says:

    Can we run two different TestNG.xml in one POM.xml ?

    1. Yes you can run n number of xml from pom.xml

  5. sheshukumar says:

    Hi Mukesh,

    I am getting below error in POM file in Jankin. Plugins showing an error in my xml file.

    org.apache.maven.plugins
    maven-compiler-plugin
    3.0

    1.8
    1.6
    1.6

    org.apache.maven.plugins
    maven-surefire-plugin
    2.17

    ${suiteXmlFile}

    1. Hey Sheshu,

      You can pass testng.xml path in ${suiteXmlFile}

  6. Amit says:

    Hello Mukesh,

    I Appreciate your work 🙂

    This is nice information

    I have one problem

    I have done as per your instructions but I am getting error

    MAVEN_HOME is set to an invalid directory

    1. can you send screenshot ?

  7. Priyabrata Samal says:

    localhost:8080 unable to connect.

    1. Kindly run on another port

  8. Ashwini says:

    Hi Mukesh,
    Am facing issue when i import existing maven project . Getting error in POM.xml. Am using Neon 4.6.1 version. Below is the error messgae .

    CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out

    and maven dependency problem , maven configuration problem, maven problem.

    Please help me what needs to be done.

    1. Ashwini, it seems you are running behind proxy.

  9. Raghavendra says:

    Hi Mukesh,

    when i run the TestNg.xml file i am getting the below error “parameter is required by @configuration on method but not has been marked optional or defined error in selenium”, i tried every suggestions given in google, but still none of them are working, can you please help me in this regard.

    Now, with i am writing a class and using the browser value

    public class Test1{
    @Test
    @parameters(“Browser”)
    public void setUp(String browser){
    syso();
    }

    Now if i run the program, i get the above error, please help me ASAP.

    1. Make sure parameter is passed correctly from xml and you have to execute all programs from xml file only.

    2. Raghavendra says:

      Hi Mukesh,

      i am passing the parameters in the TestNG.xml file correctly, but still i am getting the error

      i am not able to paste the TestNG.xml file here, as i am getting error while trying to paste it.

      Thanks
      Raghavendra.B.K.

      1. please check xml syntax.

  10. sudhr says:

    IN maven.From where the updated jar files are downloaded. Do we have to do manually intervention or it updated automatically without manual interventio

    1. Its downloaded from central maven repository

  11. satish says:

    Hi Mukesh

    Please solve my error, First i got the error
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    Then i changed the path from JRE to JDK . Then i am getting the below error

    [INFO] Scanning for projects…
    [INFO]
    [INFO] ————————————————————————
    [INFO] Building com.automation.hybrid 0.0.1-SNAPSHOT
    [INFO] ————————————————————————
    [INFO]
    [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ com.automation.hybrid —
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] — maven-compiler-plugin:3.0:compile (default-compile) @ com.automation.hybrid —
    [INFO] Nothing to compile – all classes are up to date
    [INFO]
    [INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ com.automation.hybrid —
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] — maven-compiler-plugin:3.0:testCompile (default-testCompile) @ com.automation.hybrid —
    [INFO] Changes detected – recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
    [INFO] Compiling 10 source files to F:\TESTING\PROJECTS\HybridFramework\target\test-classes
    [INFO] ————————————————————-
    [ERROR] COMPILATION ERROR :
    [INFO] ————————————————————-
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[10,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[11,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[12,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[21,9] cannot find symbol
    symbol: class ExtentReports
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[22,9] cannot find symbol
    symbol: class ExtentTest
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[11,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[12,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[13,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[23,9] cannot find symbol
    symbol: class ExtentReports
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[24,9] cannot find symbol
    symbol: class ExtentTest
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[27,30] cannot find symbol
    symbol: class ExtentReports
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[31,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[41,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[43,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[47,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[49,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[29,30] cannot find symbol
    symbol: class ExtentReports
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[33,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[43,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[45,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[49,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[51,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[52,28] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[62,36] cannot find symbol
    symbol: variable LogStatus
    location: class testcases.VerifyLoginPageWithReports
    [INFO] 24 errors
    [INFO] ————————————————————-
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 12.530 s
    [INFO] Finished at: 2016-07-16T19:39:41+05:30
    [INFO] Final Memory: 21M/296M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project com.automation.hybrid: Compilation failure: Compilation failure:
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[10,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[11,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[12,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[21,9] cannot find symbol
    [ERROR] symbol: class ExtentReports
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[22,9] cannot find symbol
    [ERROR] symbol: class ExtentTest
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[11,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[12,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[13,39] package com.relevantcodes.extentreports does not exist
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[23,9] cannot find symbol
    [ERROR] symbol: class ExtentReports
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[24,9] cannot find symbol
    [ERROR] symbol: class ExtentTest
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[27,30] cannot find symbol
    [ERROR] symbol: class ExtentReports
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[31,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[41,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[43,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[47,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPage.java:[49,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPage
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[29,30] cannot find symbol
    [ERROR] symbol: class ExtentReports
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[33,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[43,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[45,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[49,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[51,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[52,28] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] /F:/TESTING/PROJECTS/HybridFramework/src/test/java/testcases/VerifyLoginPageWithReports.java:[62,36] cannot find symbol
    [ERROR] symbol: variable LogStatus
    [ERROR] location: class testcases.VerifyLoginPageWithReports
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

      1. Ankit saxena says:

        It still not working for me after making all the configuration which you documented in the above link..

        1. Hi Ankit,

          Send me your pom.xml file I will cross check from my side.

  12. sir i am getting bellow error while configure maven test from pom.xml

    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 12.932 s
    [INFO] Finished at: 2016-07-14T16:50:10+05:30
    [INFO] Final Memory: 8M/21M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project mavenAuto: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process
    [ERROR] org.apache.maven.surefire.testset.TestSetFailedException: Suite file D:\javaselenium\mavenAuto\src\main\resources\test.xml is not a valid file
    [ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.locateTestSets(TestNGXmlTestSuite.java:116)
    [ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:84)
    [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

    1. Seems xml is not in valid location. Kindly make the changes and run again.

  13. sudhr says:

    hi,
    how to run maven project from command prompt

    1. navigate till pom.xml file location and then run mvn clean install test

  14. Pritam says:

    Hi Mukesh,
    getting below issue .
    “[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project com.learnAutomation.selenium: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process”

    Please guide

    [INFO] Scanning for projects…
    [INFO]
    [INFO] ————————————————————————
    [INFO] Building Marven project 0.0.1-SNAPSHOT
    [INFO] ————————————————————————
    [INFO]
    [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ com.learnAutomation.selenium —
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] — maven-compiler-plugin:3.0:compile (default-compile) @ com.learnAutomation.selenium —
    [INFO] Nothing to compile – all classes are up to date
    [INFO]
    [INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ com.learnAutomation.selenium —
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] — maven-compiler-plugin:3.0:testCompile (default-testCompile) @ com.learnAutomation.selenium —
    [INFO] Changes detected – recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
    [INFO] Compiling 1 source file to C:\Users\IBM_ADMIN\Desktop\Selenium\worksp\com.selenium.maven\target\test-classes
    [INFO]
    [INFO] — maven-surefire-plugin:2.17:test (default-test) @ com.learnAutomation.selenium —
    [INFO] Surefire report directory: C:\Users\IBM_ADMIN\Desktop\Selenium\worksp\com.selenium.maven\target\surefire-reports

    ——————————————————-
    T E S T S
    ——————————————————-

    Results :

    Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 4.742 s
    [INFO] Finished at: 2016-07-13T00:57:21+05:30
    [INFO] Final Memory: 15M/197M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project com.learnAutomation.selenium: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process
    [ERROR] org.apache.maven.surefire.testset.TestSetFailedException: Suite file C:\Users\IBM_ADMIN\Desktop\Selenium\worksp\com.selenium.maven\src\main\resources\testng.xml is not a valid file
    [ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.locateTestSets(TestNGXmlTestSuite.java:116)
    [ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:84)
    [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

    1. Hi,

      Seems like you have not added testng.xml file properly in pom.xml file.

  15. Ritesh kumar says:

    Hello sir,

    while running my test from pom.xml than getting this error.please review

    COMPILATION ERROR :
    [INFO] ————————————————————-
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [INFO] 1 error
    [INFO] ————————————————————-
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 1.578 s
    [INFO] Finished at: 2016-06-23T09:48:30+05:30
    [INFO] Final Memory: 9M/108M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project Next_Maven: Compilation failure
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

  16. Ritesh kumar says:

    Hello sir,

    I am getting this error while running my code as pom.xml->run as maven test.

    [INFO] Scanning for projects…
    [INFO]
    [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
    [INFO]
    [INFO] ————————————————————————
    [INFO] Building Demo program for maven 0.0.1-SNAPSHOT
    [INFO] ————————————————————————
    [INFO]
    [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ com.learn_selenium —
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 1 resource
    [INFO]
    [INFO] — maven-compiler-plugin:3.0:compile (default-compile) @ com.learn_selenium —
    [INFO] Nothing to compile – all classes are up to date
    [INFO]
    [INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ com.learn_selenium —
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] — maven-compiler-plugin:3.0:testCompile (default-testCompile) @ com.learn_selenium —
    [INFO] Changes detected – recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
    [INFO] Compiling 1 source file to C:\Users\Ritesh\workspace\com.learn_selenium\target\test-classes
    [INFO] ————————————————————-
    [ERROR] COMPILATION ERROR :
    [INFO] ————————————————————-
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [INFO] 1 error
    [INFO] ————————————————————-
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 1.585 s
    [INFO] Finished at: 2016-05-29T03:25:26-08:00
    [INFO] Final Memory: 8M/99M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:testCompile (default-testCompile) on project com.learn_selenium: Compilation failure
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

  17. Sanjay Mohan says:

    Hi Mukesh,

    After setting the System & User variables,when I tried verifying if my setup is correct or not in the Command prompt I was getting the following error message –
    Error: Java_HOME not found in your environment.
    Please set the JAVA_HOME variable in your environment to match the location of your java installation

    This is what I set in the User variable – C:\Users\OM\Downloads\apache-maven-3.3.9-bin\apache-maven-3.3.9(I don’t think this to be wrong)

    This is what I set in the System variable –
    %CommonProgramFiles%\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Users\OM\Downloads\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;

    After seeing the error message in Cmd,I updated the system variable to this – C:\Program Files\Java;C:\Users\OM\Downloads\apache-maven-3.3.9-bin\apache-maven-3.3.9;
    but now I was getting the error message as ‘mvn’ is not recognized as an internal or external command

    Please correct me where my error is.

    1. PLease Check JAVA_HOME path and it should work after this.

  18. Kumar says:

    Hi Mukesh

    can you please post how to generate XSLT reports using Maven.it will great help for me.

    1. Hi Kumar,

      If you are planning with Maven then Try extent report and its awesome. I have updated the video for the same please check in my youtube playlist.

  19. Shashank A J says:

    Hi Mukesh

    Im getting error after adding Maven compiler plugin in pom.xml. I am using Eclipse Luna JRE 1.7 is the library I have added.Should we add J2SE Jre library or Normal JRE library, Will It make any difference. Im Using Java8 JDK.
    Please help me in getting solution

  20. Mrutyunjaya Sahu says:

    org.apache.maven.plugins
    maven-compiler-plugin

    1.6
    1.6

    org.apache.maven.plugins
    maven-surefire-plugin
    2.6

    ${suiteXmlFile}

    true

    I am getting below error while configuring my pom.xml file,
    Error resolving version for plugin ‘org.apache.maven.plugins:maven-compliler-plugin’ from the repositories
    [local (C:\Users\sates\.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in
    any plugin repository.

    From google I found one link i.e.
    http://stackoverflow.com/questions/10612838/unable-to-download-the-artifact-maven-compiler-plugin-from-repository

    In that link “2.3.2” is there. And i have tried with this below tag and then that pom.xml file error escaped. but after execution “Build Failure” Error is showing in command prompt.

    org.apache.maven.plugins
    maven-compiler-plugin
    2.3.2

    1.6
    1.6

    1. Hi,

      Please follow below link and try the same.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.