JUnit version 3.8 or later expected
Hi guys,
I am getting this rather strange error... I think I know WHY I am getting it, just don't know how to solve the problem.
Here is my setup:
OS: Windows 7 64bit
I have Maven installed and set up:
$ mvn --version
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: c:\Development\Maven
Java version: 1.6.0_20, vendor: Sun Microsystems Inc.
Java home: c:\Program Files (x86)\Java\jdk1.6.0_20\jre
Default locale: da_DK, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
I have created a multi module where I have a parent pom.xml and one Android project and one Android Integration Test project. In the Android project I have also created a /src/test/ folder where I have placed the unit tests that are not integration tests.
When I run
$ mvn clean install
the unit tests run fine and all pass. I get a successful build and everyone is happy.
But when I try to create a JUnit Run Configuration in IntelliJ and then run it to run my unit tests, I get the following error:
!!! JUnit version 3.8 or later expected
From what I can figure out, the compiler tries to use the JUnit framework from the Android jars. This is of course wrong, so what I tried to do was to go into the module settings for the Android project and move the JUnit 4 dependency up above the Android dependency. But that doesn't make any difference. I suspect that this is because it is a Maven dependency, but I don't know... and I haven't been able to figure out how to get around this.
So I am hoping someone here can tell me what I need to do, to get this to work in IntelliJ...
Thanks,
Jay
请先登录再写评论。
Did you try to change the order of dependencies inside the pom file so that Android SDK comes after JUnit? If it doesn't help, then file a bug at http://youtrack.jetbrains.net/issues/IDEA, it could be a problem with importing Android project from Maven and this case with JUnit would need a special treatment.
And you are right, you can't change the order manually in IDEA project settings as it will be discarded on Maven project re-import.
Thanks, that fixed the problem for me with maven3 / android platform 17 / intellij 12.1.2