Wednesday, July 22, 2009

m2Eclipse and JUnit4: 'no tests found' - solved

Just a quick note: I have a project in Eclipse which is maven-based, and generated initially using the "new maven project" wizard in Eclipse. I'm using JUnit 4.5 for the unit tests, and could quite happily run the tests from the command line using maven, and individual tests from Eclipse using run as JUnit test.... However, when I tried to run all of the tests in the project by invoking run as JUnit test... on the project root node, Eclipse complained "no tests found with test runner junit 4". Solved by upgrading m2eclipse to the latest stable development build from the m2eclipse update site (specifically, I upgraded from version to version in Eclipse Galileo).

Wednesday, July 15, 2009

Eclipse/maven: solution to cannot nest folders problem

I had the following problem with Eclipse 3.5 (Galileo) and m2Eclipse 0.9.8, but from searching I believe that it occurs with other combinations as well. Situation: I have a maven-ized project in subversion, and I want to check it out into my Eclipse workspace. Method: bring up the subversion repositories view, navigate to the repository folder with the project in it, right click, select the "Check out as Maven Project ..." context-menu option. All seems to be OK – the project gets created, maven dependencies are resolved, etc, except Problem symptom: Eclipse complains that Cannot nest 'rdfutil/src/test/java' inside 'rdfutil/src'. To enable the nesting exclude 'test/' from 'rdfutil/src' (your project name will obviously differ). And there's a red 'compilation failed' triangle in the problems list. Check the Java build path, all is fine. Check the pom.xml, all is fine. What to do? Solution Right-click the project node in the project explorer window to first close it, and then again to delete the project, but without removing the project contents on disk. Then, right-click in the project explorer window to "Import ... > Existing project into workspace ...". Navigate to the location of the project, import, and it comes back without the nested file warning.