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.
Summary: | Unable to launch Junit test in maven project | ||
---|---|---|---|
Product: | projects | Reporter: | newbeewan2 |
Component: | Maven | Assignee: | Jesse Glick <jglick> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | chrishhde |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
newbeewan2
2010-06-03 08:54:50 UTC
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 *** |