Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mvn test fails with "Test (wrong name: maven-launcher/system-dependency/target/classes/Test)" #3547

Open
Strum355 opened this issue Aug 25, 2020 · 7 comments

Comments

@Strum355
Copy link
Contributor

Strum355 commented Aug 25, 2020

Maven version: 3.6.3
Java versions: jdk8, 11 and 14
OS: arch linux
Followed https://github.com/INRIA/spoon#compiling

[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[ERROR] Test (wrong name: maven-launcher/system-dependency/target/classes/Test)
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:12 min
[INFO] Finished at: 2020-08-25T11:34:15Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project spoon-core: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/mvn/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] Test (wrong name: maven-launcher/system-dependency/target/classes/Test)
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] Test (wrong name: maven-launcher/system-dependency/target/classes/Test)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:733)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:305)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:265)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
[ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
[ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
[ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
[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:564)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] 
[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
@MartinWitt
Copy link
Collaborator

MartinWitt commented Aug 25, 2020

Did you only compile the code with maven compile or some more commands? Maven shouldn't start tests if you use maven compile command, (see lifecycles here).

@Strum355
Copy link
Contributor Author

I ran mvn compile followed by mvn test

@MartinWitt
Copy link
Collaborator

Could you provide a full log?

@Strum355
Copy link
Contributor Author

> mvn test
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] 
[INFO] ------------------< fr.inria.gforge.spoon:spoon-core >------------------
[INFO] Building Spoon Core 8.4.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from maven.inria.fr-snapshot: https://maven.irisa.fr/artifactory/spoon-public-snapshot/junit/junit-dep/maven-metadata.xml
[WARNING] Could not transfer metadata junit:junit-dep/maven-metadata.xml from/to maven.inria.fr-snapshot (https://maven.irisa.fr/artifactory/spoon-public-snapshot): Transfer failed for https://maven.irisa.fr/artifactory/spoon-public-snapshot/junit/junit-dep/maven-metadata.xml
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spoon-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spoon-core ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spoon-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 346 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ spoon-core ---
[INFO] Compiling 1 source file to /home/noah/Java/spoon/target/test-classes
[WARNING] bootstrap class path not set in conjunction with -source 8
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ spoon-core ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[ERROR] Test (wrong name: maven-launcher/system-dependency/target/classes/Test)
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.955 s
[INFO] Finished at: 2020-08-25T18:59:22+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project spoon-core: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/noah/Java/spoon/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] Test (wrong name: maven-launcher/system-dependency/target/classes/Test)
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] Test (wrong name: maven-launcher/system-dependency/target/classes/Test)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:733)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:305)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:265)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
[ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
[ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
[ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
[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:564)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] 
[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

@MartinWitt
Copy link
Collaborator

MartinWitt commented Aug 25, 2020

Reading your log, #2867 looks related. Sadly i cant reproduce your bug currently, but i used windows.
Edit: As a tempoary solution you could try running gradle init and

sourceSets {
    main {
        resources {
            exclude("*")
        }
    }
    test {
        resources {
            exclude("*")
        }
    }

in build.gradle. gradle init can convert maven builds.

@Strum355
Copy link
Contributor Author

Strum355 commented Aug 25, 2020

with the sourceSets set, every test failed with MissingResource exception.
With it commented out, here are the following failed tests

spoon.test.reference.ExecutableReferenceTest > testSpecifyGetAllExecutablesMethod FAILED
    java.lang.AssertionError: expected:<13> but was:<12>
        ...
        at spoon.test.reference.ExecutableReferenceTest.testSpecifyGetAllExecutablesMethod(ExecutableReferenceTest.java:140)

spoon.test.model.TypeTest > testGetAllExecutables FAILED
    java.lang.AssertionError: expected:<16> but was:<15>
        ...
        at spoon.test.model.TypeTest.testGetAllExecutables(TypeTest.java:53)

spoon.test.model.TypeTest > testAllTypeMembersFunctionMode FAILED
    java.lang.AssertionError: expected:<17> but was:<16>
        ...
        at spoon.test.model.TypeTest.testAllTypeMembersFunctionMode(TypeTest.java:68)

spoon.test.factory.TypeFactoryTest > reflectionAPI FAILED
    java.lang.AssertionError: expected:<3> but was:<5>
        ...
        at spoon.test.factory.TypeFactoryTest.reflectionAPI(TypeFactoryTest.java:65)

spoon.support.visitor.java.JavaReflectionTreeBuilderTest > testPartialShadow FAILED
    java.lang.AssertionError: expected:<0> but was:<8>
        ...
        at spoon.support.visitor.java.JavaReflectionTreeBuilderTest.testPartialShadow(JavaReflectionTreeBuilderTest.java:596)

Edited with assertion error info

@MartinWitt
Copy link
Collaborator

MartinWitt commented Aug 25, 2020

with the sourceSets set, every test failed with MissingResource exception.
With it commented out, here are the following failed tests

spoon.test.reference.ExecutableReferenceTest > testSpecifyGetAllExecutablesMethod FAILED
    java.lang.AssertionError: expected:<13> but was:<12>
        ...
        at spoon.test.reference.ExecutableReferenceTest.testSpecifyGetAllExecutablesMethod(ExecutableReferenceTest.java:140)

Fails on my side too, but CI works somehow. It should be 12, if Object has 11 methods on all jdks.

spoon.test.model.TypeTest > testGetAllExecutables FAILED
java.lang.AssertionError: expected:<16> but was:<15>
...
at spoon.test.model.TypeTest.testGetAllExecutables(TypeTest.java:53)

Fails on my side too, but CI works somehow.

spoon.test.model.TypeTest > testAllTypeMembersFunctionMode FAILED
java.lang.AssertionError: expected:<17> but was:<16>
...
at spoon.test.model.TypeTest.testAllTypeMembersFunctionMode(TypeTest.java:68)

Fails on my side too, but CI works somehow.

spoon.test.factory.TypeFactoryTest > reflectionAPI FAILED
java.lang.AssertionError: expected:<3> but was:<5>
...
at spoon.test.factory.TypeFactoryTest.reflectionAPI(TypeFactoryTest.java:65)

Fails on my side too, but CI works somehow.

spoon.support.visitor.java.JavaReflectionTreeBuilderTest > testPartialShadow FAILED
java.lang.AssertionError: expected:<0> but was:<8>
...
at spoon.support.visitor.java.JavaReflectionTreeBuilderTest.testPartialShadow(JavaReflectionTreeBuilderTest.java:596)

Looks like I need to have a look into the CI. I always thought the failed tests are a windows issue and lived with it.

Edit:
Looks interesting.
Reading here java-bug in object a method was removed.
in jdk-14 the method Object.registerNatives is missing and in jdk-8 the method is still there. This is the reason, for the failing test cases.
@monperrus whats your opinion on the bug? Currently we have testcases that a highly jdk (version or manufacture?) dependent.
Edit 2:
The reason for the following fails is the Object.registerNatives Problem
spoon.test.model.TypeTest > testAllTypeMembersFunctionMode
spoon.test.model.TypeTest > testGetAllExecutables FAILED
spoon.test.reference.ExecutableReferenceTest > testSpecifyGetAllExecutablesMethod
Edit 3:
the reason for the following falling test is that String.class has 2 new Interfaces since jdk12
java.lang.constant.Constable
java.lang.constant.ConstantDesc
spoon.test.factory.TypeFactoryTest > reflectionAPI

Edit 4:
Somehow the following test works inside intellij and maven but not run with gradle.
Gradle resolves the dependency and the test fails.
spoon.support.visitor.java.JavaReflectionTreeBuilderTest > testPartialShadow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants