0

I am trying to run a maven project from GitHub actions but it's failing with a lot of errors which I am unable to resolve. Any help is highly appreciated.

Error:

2023-03-02T19:55:03.1308665Z [INFO] -------------------------------------------------------
2023-03-02T19:55:03.1309334Z [INFO]  T E S T S
2023-03-02T19:55:03.1309709Z [INFO] -------------------------------------------------------
2023-03-02T19:55:03.7212762Z [INFO] 
2023-03-02T19:55:03.7213543Z [INFO] Results:
2023-03-02T19:55:03.7213970Z [INFO] 
2023-03-02T19:55:03.7230143Z [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
2023-03-02T19:55:03.7230436Z [INFO] 
2023-03-02T19:55:03.7285928Z [INFO] ------------------------------------------------------------------------
2023-03-02T19:55:03.7286503Z [INFO] BUILD FAILURE
2023-03-02T19:55:03.7287068Z [INFO] ------------------------------------------------------------------------
2023-03-02T19:55:03.7302478Z [INFO] Total time:  7.605 s
2023-03-02T19:55:03.7305208Z [INFO] Finished at: 2023-03-02T19:55:03Z
2023-03-02T19:55:03.7306231Z [INFO] ------------------------------------------------------------------------
2023-03-02T19:55:03.7315453Z [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project denodoproject: There are test failures.
2023-03-02T19:55:03.7316101Z [ERROR] 
2023-03-02T19:55:03.7317796Z [ERROR] Please refer to /home/runner/work/denodo_CI_CD/denodo_CI_CD/target/surefire-reports for the individual test results.
2023-03-02T19:55:03.7318580Z [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
2023-03-02T19:55:03.7319475Z [ERROR] There was an error in the forked process
2023-03-02T19:55:03.7320519Z [ERROR] Suite file /home/runner/work/denodo_CI_CD/denodo_CI_CD/testng.xml is not a valid file
2023-03-02T19:55:03.7321637Z [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
2023-03-02T19:55:03.7322487Z [ERROR] Suite file /home/runner/work/denodo_CI_CD/denodo_CI_CD/testng.xml is not a valid file
2023-03-02T19:55:03.7323596Z [ERROR]    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:657)
2023-03-02T19:55:03.7324553Z [ERROR]    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283)
2023-03-02T19:55:03.7325514Z [ERROR]    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
2023-03-02T19:55:03.7326565Z [ERROR]    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1161)
2023-03-02T19:55:03.7327529Z [ERROR]    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1002)
2023-03-02T19:55:03.7328448Z [ERROR]    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:848)
2023-03-02T19:55:03.7329281Z [ERROR]    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
2023-03-02T19:55:03.7330233Z [ERROR]    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:342)
2023-03-02T19:55:03.7331185Z [ERROR]    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:330)
2023-03-02T19:55:03.7333467Z [ERROR]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
2023-03-02T19:55:03.7334284Z [ERROR]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:175)
2023-03-02T19:55:03.7335259Z [ERROR]    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:76)
2023-03-02T19:55:03.7335819Z [ERROR]    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:163)
2023-03-02T19:55:03.7336637Z [ERROR]    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
2023-03-02T19:55:03.7337270Z [ERROR]    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:160)
2023-03-02T19:55:03.7337908Z [ERROR]    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
2023-03-02T19:55:03.7339932Z [ERROR]    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
2023-03-02T19:55:03.7340915Z [ERROR]    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
2023-03-02T19:55:03.7341820Z [ERROR]    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
2023-03-02T19:55:03.7342725Z [ERROR]    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:260)
2023-03-02T19:55:03.7344494Z [ERROR]    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:172)
2023-03-02T19:55:03.7344946Z [ERROR]    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:100)
2023-03-02T19:55:03.7348803Z [ERROR]    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:821)
2023-03-02T19:55:03.7350150Z [ERROR]    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:270)
2023-03-02T19:55:03.7351361Z [ERROR]    at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
2023-03-02T19:55:03.7351775Z [ERROR]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-03-02T19:55:03.7355639Z [ERROR]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2023-03-02T19:55:03.7356926Z [ERROR]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-03-02T19:55:03.7357418Z [ERROR]    at java.lang.reflect.Method.invoke(Method.java:498)
2023-03-02T19:55:03.7357904Z [ERROR]    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
2023-03-02T19:55:03.7358471Z [ERROR]    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
2023-03-02T19:55:03.7359040Z [ERROR]    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
2023-03-02T19:55:03.7359611Z [ERROR]    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

Can anyone help me to resolve this? I have changed the plugin versions and everything possible.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M3</version>
    <inherited>true</inherited>
    <configuration>
        <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
        </suiteXmlFiles>
    </configuration>
</plugin>

The testng.xml points to the class I want to run. Thanks in advance!

Update: Was able to resolve the issue by adding the full path of the testng.xml file but getting the following error now:

Cannot find class in classpath: denodoproject.test001GET
Error:  org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process

Here's the screenshot of the folder structure and the testng.xml file is added:

directory structure

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
  <test thread-count="5" name="Test">
    <classes>
      <class name="denodoproject.test001GET"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

Adding the workflow used in github actions:

name: Java CI with Maven

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8

    - name: Build with Maven
      run: mvn clean test

Error:

enter image description here

User1515
  • 11
  • 7
  • Is the `testng.xml` file checked in in the repository? If so, where is it located? – dan1st Mar 02 '23 at 20:12
  • @dan1st: it is in the same repo under the project folder. Is the error because testing.xml is not accessible? – User1515 Mar 02 '23 at 21:10
  • Error: "**Suite file /home/runner/work/denodo_CI_CD/denodo_CI_CD/testng.xml is not a valid file**". Please include your directory structure in your question along with your relevant workflow. Also, as commented earlier, verify the existence and contents of the `testing.xml` if it's checked into the repo. Thanks! – Azeem Mar 03 '23 at 04:30
  • @Azeem: resolved the issue by copying the actual path of the testng.xml and adding it but now i am getting the following error: Cannot find class in classpath: denodoproject.test001GET Error: org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process – User1515 Mar 03 '23 at 05:53
  • @User1515: Please edit your question and add this under an UPDATE section. Regarding the new classpath error, this looks relevant https://stackoverflow.com/questions/7600898/testng-error-cannot-find-class-in-classpath. – Azeem Mar 03 '23 at 05:59
  • @Azeem: updated. And i checked the link. I am running the project from Github actions and doing a clean before run: run: mvn clean test – User1515 Mar 03 '23 at 06:12
  • @User1515: Is it working locally? No errors? – Azeem Mar 03 '23 at 06:28
  • @Azeem: yes its working locally with no errors. I didnt have to even change the path of testng.xml in local which had resolved the earlier issue – User1515 Mar 03 '23 at 07:18
  • @User1515: That's strange. You might want to include your relevant workflow in your question as well. Apart from that, it looks like an [MCVE](https://stackoverflow.com/help/minimal-reproducible-example) would help to reproduce this. If this is a public repo, you can share its link. Otherwise, a stripped down version of this repo would help reproduce this in isolation. – Azeem Mar 03 '23 at 07:22
  • 1
    @Azeem: Repo: https://github.com/paras21avenue/denodo.git Added the workflow im using in the question – User1515 Mar 03 '23 at 10:36
  • @User1515: Your repo doesn't have the workflow that you included in your question. Were you testing it on the same repo? – Azeem Mar 03 '23 at 17:10
  • @Azeem: yes , the code in edited with no actual code as the actual code is private, just a Printf was added to duplicate the scenario. The actual repo is private. But the same repo has been duplicated. The workflow I’m using is in the other repo. I will add the workflow if it’s needed – User1515 Mar 03 '23 at 18:13
  • Added workflow to the repo – User1515 Mar 03 '23 at 19:35
  • @User1515: Thanks! The `pom.xml` on the root of the repo is the same as it is in the `denodoproject` directory. Running `cd denodoproject` and `mvn clean test` works fine. See https://github.com/iamazeem/test/actions/runs/4329774294/workflow#L22-L23. It's on the root where the error occurs. You need to configure your project accordingly, maybe have a root `pom.xml` configured to point to other subprojects and vice versa. – Azeem Mar 04 '23 at 07:01
  • @Azeem: thanks but if i replicate the exact same thing in my actual project. I still get classpath not found, its very strange. Im running : cd Promotion and mvn clean test. Screenshot of project str is attached in question. POM is actuall the exact replica, even the class name is the same. I just dont have package created in the actual project. – User1515 Mar 04 '23 at 07:44
  • 1
    Something related to the project str i assume, i reverted to the exact same and it works. Will work with that. thanks a lot – User1515 Mar 04 '23 at 08:24

0 Answers0