MobilityData / gtfs-realtime-validator

Java-based tool that validates General Transit Feed Specification (GTFS)-realtime feeds
Other
41 stars 10 forks source link

"mvn clean test" fails with ClassNotFoundException for JUnit4Provider #76

Closed isabelle-dr closed 2 years ago

isabelle-dr commented 2 years ago

Issue by barbeau Feb 25, 2020 Originally opened as https://github.com/CUTR-at-USF/gtfs-realtime-validator/issues/372


Summary:

When running mvn clean test from the command line with JDK 11.0.5 the process fails with a ClassNotFoundException for JUnit4Provider:

E:\Git Projects\gtfs-realtime-validator>mvn clean test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for edu.usf.cutr:gtfs-realtime-validator-webapp:jar:1.0.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: edu.usf.cutr:gtfs-realtime-validator-lib:jar -> duplicate dec
laration of version 1.0.0-SNAPSHOT @ line 150, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] gtfs-realtime-validator
[INFO] gtfs-realtime-validator-lib
[INFO] gtfs-realtime-validator-webapp
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gtfs-realtime-validator 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ gtfs-realtime-validator ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gtfs-realtime-validator-lib 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ gtfs-realtime-validator-lib ---
[INFO] Deleting E:\Git Projects\gtfs-realtime-validator\gtfs-realtime-validator-lib\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gtfs-realtime-validator-lib ---
[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.7.0:compile (default-compile) @ gtfs-realtime-validator-lib ---
[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 46 source files to E:\Git Projects\gtfs-realtime-validator\gtfs-realtime-validator-lib\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ gtfs-realtime-validator-lib ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ gtfs-realtime-validator-lib ---
[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 14 source files to E:\Git Projects\gtfs-realtime-validator\gtfs-realtime-validator-lib\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ gtfs-realtime-validator-lib ---
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/3.0.0-M3/surefire-junit4-3.0.0-M3.jar
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] gtfs-realtime-validator ............................ SUCCESS [  0.414 s]
[INFO] gtfs-realtime-validator-lib ........................ FAILURE [ 17.681 s]
[INFO] gtfs-realtime-validator-webapp ..................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.268 s
[INFO] Finished at: 2020-02-25T10:21:42-05:00
[INFO] Final Memory: 22M/84M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project gtfs-realtime-validator-lib: The
re are test failures.
[ERROR]
[ERROR] Please refer to E:\Git Projects\gtfs-realtime-validator\gtfs-realtime-validator-lib\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] There was an error in the forked process
[ERROR] java.lang.ClassNotFoundException: org.apache.maven.surefire.junit4.JUnit4Provider
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] java.lang.ClassNotFoundException: org.apache.maven.surefire.junit4.JUnit4Provider
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:657)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1161)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1002)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:848)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :gtfs-realtime-validator-lib

It may be related to this change (?) - #355

...which bumped the maven-surefire-plugin dependency from 2.20.1 to 3.0.0-M3.

This is important to fix because it blocks our release process.

Steps to reproduce:

Run mvn clean test on the command line

Expected behavior:

Tests should execute and pass

Observed behavior:

Tests fail with ClassNotFoundException for JUnit4Provider.

Platform:

Master branch of library as of 8fd8cca

E:\Git Projects\gtfs-realtime-validator>mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T09:51:42-04:00)
Maven home: C:\Program Files (x86)\Apache Software Foundation\apache-maven-3.2.2
Java version: 11.0.5, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk-11.0.5
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
isabelle-dr commented 2 years ago

Comment by barbeau Feb 25, 2020


This seems to work fine on Travis with OpenJDK 11:

mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
mvn test -B

...but not on my machine - I get the same error.

isabelle-dr commented 2 years ago

Comment by barbeau Dec 07, 2021


This is now blocked by #399 using the most recent version of Maven.

barbeau commented 2 years ago

Using java version "11.0.12" 2021-07-20 LTS and apache-maven-3.8.4 on Windows 10 with:

mvn clean test

...I can no longer reproduce this (project builds successfully), so I'm closing this issue.