title: how to fix the maven surefire plugin error [there was error in the forked process]?
body: <p>I am trying to run my sample project which uses Maven- testNG-cucumber  and deploy it using docker . here is my Dockerfile </p>
  
  <pre><code>FROM    maven:3.6.0-jdk-8
  RUN     mkdir /docker
  WORKDIR /docker
  COPY    pom.xml .
  COPY    testng.xml .
  COPY    src .
  RUN     mvn clean verify 
  </code></pre>
  
  <h2>POM.XML</h2>
  
  <pre><code>    &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;info.cukes&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;
          &lt;version&gt;1.2.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;info.cukes&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-jvm-deps&lt;/artifactId&gt;
          &lt;version&gt;1.0.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;info.cukes&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-testng&lt;/artifactId&gt;
          &lt;version&gt;1.2.5&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;junit&lt;/groupId&gt;
                  &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.testng&lt;/groupId&gt;
          &lt;artifactId&gt;testng&lt;/artifactId&gt;
          &lt;version&gt;6.9.8&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.masterthought&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-reporting&lt;/artifactId&gt;
          &lt;version&gt;3.8.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
          &lt;version&gt;2.44.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.20.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;suiteXmlFiles&gt;
                      &lt;suiteXmlFile&gt;testng.xml&lt;/suiteXmlFile&gt;
                  &lt;/suiteXmlFiles&gt;
                  &lt;useSystemClassLoader&gt;false&lt;/useSystemClassLoader&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;net.masterthought&lt;/groupId&gt;
              &lt;artifactId&gt;maven-cucumber-reporting&lt;/artifactId&gt;
              &lt;version&gt;3.8.0&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;execution&lt;/id&gt;
                      &lt;phase&gt;verify&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;generate&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;projectName&gt;Sample&lt;/projectName&gt;
                          &lt;outputDirectory&gt;target/cucumber-reports/advanced-reports&lt;/outputDirectory&gt;
                          &lt;cucumberOutput&gt;target/cucumber-reports/CucumberTestReport.json&lt;/cucumberOutput&gt;
                          &lt;buildNumber&gt;1&lt;/buildNumber&gt;
                          &lt;parallelTesting&gt;false&lt;/parallelTesting&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>above scenario works completely fine when i run the project locally using <strong>mvn verify</strong> .Then i try to build the image using <strong>docker build -t sample .</strong> . this time i have got the following error .  </p>
  
  <pre><code> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project Sample: There are test failures.
   [ERROR] Please refer to /docker/target/surefire-reports for the individual test results.
  
   [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
  
   [ERROR] There was an error in the forked process
  
   [ERROR] Cannot find class in classpath: TestRunner
   [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
  
   [ERROR] Cannot find class in classpath: TestRunner
   [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork
   (ForkStarter.java:673)
   [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork
   (ForkStarter.java:535)
   [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run 
   (ForkStarter.java:280)
   [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run
   (ForkStarter.java:245)
   [ERROR] at 
   org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider
   (AbstractSurefireMojo.java:1124)
   [ERROR]         at 
   org.apache.maven.plugin.surefire.AbstractSurefireMojo.
   executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)
  </code></pre>
  
  <p>Any help would be much appreciated</p>