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

Benjamin Reed commented on MPLUGINTESTING-25:
---------------------------------------------

Aha!  I did "mvn install" and *now* it runs.  So I guess there's no way to test 
the actual code *before* installing it?  The plugin test harness doesn't inject 
the current code into some kind of temporary internal repository to make it 
available to the tests?  Kind of defeats the purpose...
                
> cookbook example doesn't work
> -----------------------------
>
>                 Key: MPLUGINTESTING-25
>                 URL: https://jira.codehaus.org/browse/MPLUGINTESTING-25
>             Project: Maven 2.x Plugin Testing
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Benjamin Reed
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to