You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "adam Retter (JIRA)" <ji...@apache.org> on 2019/06/18 09:51:00 UTC

[jira] [Commented] (MPLUGINTESTING-25) cookbook example doesn't work

    [ https://issues.apache.org/jira/browse/MPLUGINTESTING-25?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16866430#comment-16866430 ] 

adam Retter commented on MPLUGINTESTING-25:
-------------------------------------------

Still appears to be an issue. This StackOverflow answer of adding `maven-compat` fixed the problem for me - [https://stackoverflow.com/questions/15779351/component-lookup-exception-with-org-apache-maven-repository-repositorysystem-in#answer-16707144]

> cookbook example doesn't work
> -----------------------------
>
>                 Key: MPLUGINTESTING-25
>                 URL: https://issues.apache.org/jira/browse/MPLUGINTESTING-25
>             Project: Maven Plugin Testing
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Benjamin Reed
>            Priority: Major
>
> I have run into issues even getting a simple unit test working with my maven plugin skeleton.  I posted about it here:
> http://mail-archives.apache.org/mod_mbox/maven-users/201206.mbox/%3C4FCCC631.6050607%40opennms.org%3E
> ...in the process of being unable to debug this failure, I figured I'd try walking through the cookbook without using any of my own code.
> Following the cookbook example fails, with this exception:
> java.lang.NoClassDefFoundError: org/apache/maven/plugin/descriptor/PluginDescriptorBuilder
> 	at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:116)
> 	at org.apache.maven.plugin.my.MyMojoTest.setUp(MyMojoTest.java:15)
> 	at junit.framework.TestCase.runBare(TestCase.java:125)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.lang.ClassNotFoundException: org.apache.maven.plugin.descriptor.PluginDescriptorBuilder
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	... 15 more
> The documentation says to use the archetype for creating a maven plugin, but by default it uses maven-plugin-api 2.0, which is incompatible with the latest plugin.  Changing it to maven-plugin-api 3.0 in pom.xml then results in the following exception:
> java.lang.NoClassDefFoundError: org/codehaus/plexus/ContainerConfiguration
> 	at java.lang.Class.getDeclaredMethods0(Native Method)
> 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
> 	at java.lang.Class.getDeclaredMethods(Class.java:1791)
> 	at junit.framework.TestSuite.<init>(TestSuite.java:73)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.ContainerConfiguration
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	... 10 more
> I've not been able to figure out how to actually unit-test the cookbook example, much less my own plugin. :P



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)