You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Elliotte Rusty Harold (Jira)" <ji...@apache.org> on 2020/06/16 11:52:00 UTC
[jira] [Commented] (MPLUGINTESTING-70) maven-compat requirement
[ https://issues.apache.org/jira/browse/MPLUGINTESTING-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17136569#comment-17136569 ]
Elliotte Rusty Harold commented on MPLUGINTESTING-70:
-----------------------------------------------------
If one removes the maven-compat dependency the tests compile. However they fail at runtime like so:
Running org.apache.maven.dependency.graph.AbstractMojoTestCaseTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.021 sec <<< FAILURE!
initializationError(org.apache.maven.dependency.graph.AbstractMojoTestCaseTest) Time elapsed: 0.004 sec <<< ERROR!
java.lang.NoClassDefFoundError: org/apache/maven/execution/MavenExecutionResult
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.junit.internal.builders.SuiteMethodBuilder.hasSuiteMethod(SuiteMethodBuilder.java:18)
at org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:10)
at org.junit.internal.requests.ClassRequest$CustomSuiteMethodBuilder.runnerForClass(ClassRequest.java:51)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:250)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.ClassNotFoundException: org.apache.maven.execution.MavenExecutionResult
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 25 more
Results :
Tests in error:
initializationError(org.apache.maven.dependency.graph.AbstractMojoTestCaseTest): org/apache/maven/execution/MavenExecutionResult
> maven-compat requirement
> ------------------------
>
> Key: MPLUGINTESTING-70
> URL: https://issues.apache.org/jira/browse/MPLUGINTESTING-70
> Project: Maven Plugin Testing
> Issue Type: Dependency upgrade
> Reporter: Elliotte Rusty Harold
> Priority: Major
> Attachments: bug.tar.gz
>
>
> I'm attaching a sample project based on work by Ian Lavallee. Briefly it demos that one can only use AbstractMojoTestCase if the pom.xml also adds a dependency on org.apache.maven:maven-compat and org.apache.maven:maven-plugin-api. The former at least seems like it should not be required.
> Furthermore if either of these are required they should probably be at least runtime dependencies of maven-plugin-testing rather than requiring client projects to ad these dependencies explicitly.
> Both of these are only required to run tests, not to compile the project.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)