This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Hi, It doesn't happen every times but when the problem starts, it is always happening... I'm using projects with a parent maven projet. Most of the time netbeans 6.9RC1 manage to launch a particular junit test. But after a while (I don't know what is the starting point...) Netbeans failed to launch Junit test with the error : WARNING: multiple versions of ant detected in path for junit jar:file:/home/mourad/application/netbeans-6.9rc1/java/ant/lib/ant.jar!/org/apache/tools/ant/Project.class and jar:file:/home/mourad/.m2/repository/org/apache/ant/ant/1.7.0/ant-1.7.0.jar!/org/apache/tools/ant/Project.class Testsuite: mypackage.MyUnitTest Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec Null Test: Caused an ERROR mypackage.MyUnitTest java.lang.ClassNotFoundException: mypackage.MyUnitTest 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:307) The only workaround I found is launching netbeans 6.8, clean-build the project and it works again on netbeans 6.9 !!
Same here on ubuntu
Same with me on Ubuntu 10.04 (Lucid) - but with NetBeans 6.8 (included in Ubuntu repos) There always are a number of issues with the different Java versions. My project is a Java 1.5 project, Ubuntu comes with a Java 1.6 standard, NetBeans 6.8 in Ubuntu is also set to Java 1.6 standard. So I'm pretty sure it's something like that, ant or maven mix something up. The following I did: - set jdk to 1.5 in /etc/netbeans.conf (netbeans_jdkhome) - work with netbeans - everything fine, including tests - set jdk to 1.6 - work with netbeans, everything fine, including tests, until I rebuild the project (having all source and target jdks set to 1.5) After that tests won't work anymore - even though I used maven in a shell and rebuild the project.
Unfortunately, Mercurial- and Subversion-Plugins won't work with Netbeans 6.8 (in Ubuntu) when using a 1.5 JDK for Netbeans.
Hi, I found a dumb workaround ! If I launch eclipse with m2eclipse module, clean the project, back to netbeans, it works again !!!!!!!! I'm suspecting some compilator listener are not doing there job on test classes (perhaps the skip test param ?) ! For me there is no link to JDK version, I'm using only Sun JDK6 and OpenJdk6... Regards
Somehow Maven doesn't seem to execute "mvn test-compile" in advance to executing a test, that's why there comes the exception - there really is no test class. See http://forums.netbeans.org/ntopic25006.html and http://maven.apache.org/guides/getting-started/index.html#How_do_I_compile_my_test_sources_and_run_my_unit_tests for reference. So in case Netbeans acts the reported way you can workaround by executing "mvn test-compile" in a shell within the regarding Maven (sub-) module. I'm not sure whether Maven options in Netbeans influence this problem - I tried using the external Maven explicitly (set the path!) and uncheck the setting "Skip Tests for any build executions not directly related to testing". Maybe that helps.
Another hint: You could try to configure a Maven toolchain in your project, as described in http://maven.apache.org/guides/mini/guide-using-toolchains.html. I'm not sure if this helps as I'm using the workaround of setting "Build - Compile" to the correct Java version for every Netbeans project properties (aka Maven module of my software).
Maven toolchains don't seem to get accounted for by NetBeans. It would be nice if they were! Otherwise you end up adding netbeans.hint.jdkPlatform for every Maven module, and test actions' JAVA_HOME settings - which is kind of cumbersome and confusing, having so many possibilities. And I wonder why it's not enough to set compileSource once in the parent pom, and have this accounted for by all involved tools and plugins including Netbeans...!? It would definitely be great to have this resolved in a simple, straight forward manner. I'm sure there are a number of people out there who 1. use Maven, 2. don't want to miss nice new NetBeans features, 3. use an old Java, and 4. have a highly modular Maven project.
(In reply to comment #7) > Maven toolchains don't seem to get accounted for by NetBeans. This seems off-topic. Please file separately, ideally with a self-contained example project I can use to verify any necessary fixes.
(In reply to comment #8) > (In reply to comment #7) > > Maven toolchains don't seem to get accounted for by NetBeans. > > This seems off-topic. Please file separately, ideally with a self-contained > example project I can use to verify any necessary fixes. I'm not too sure if toolchains is really wished for Netbeans support.... I'll file an enhancement bug, let's see if anyone votes for it. -> Done: http://netbeans.org/bugzilla/show_bug.cgi?id=189496 To me toolchains would just be one possibility of the many - that's why I named it here - hoping that it would resolve this issue with test execution. Currently, this bug costs me a lot of production time. After restarting Netbeans, a JUnit test will sometimes work. Next time you run or debug the test it'll go back to the wrong JDK.
*** This bug has been marked as a duplicate of bug 189103 ***