If I'm looking at a class (MyComponent, say) somewhere underneath src/main/java in Eclipse, I can right click it and pick new...--> other --> JUnit test. Eclipse is smart enough to guess the name for the unit test class (MyComponentTest), but it insists on putting the unit test under src/main/java. Is there anything in Eclipse or m2Eclipse that can be set so that the default test location is src/test/java? Given that's the standard way of working with Maven, there has to be a setting for this somewhere but I can't find it.
A:
When creating a junit test, you can select another source folder than 'src/main/java'
kocka
2010-08-04 09:42:27
Yes, you can. My point is I'd like the default to follow the Maven convention, rather than having to select another source folder.
GaryF
2010-08-04 10:16:35
A:
if you click 'new > junit test' while having an other source-folder selected, it will use that one as the target.
so i guess there is no 'default' it just uses the 'current' folder. sensible defaults is not what eclipse is good at.
what is eclipse good at at all?
phoet
2010-08-06 15:04:56
+1
A:
Good question, this bothers me too. I googled it and found this suggestion: http://stackoverflow.com/questions/69063/how-to-default-the-source-folder-for-new-junit-tests-in-eclipse.
Basically it says: I use moreUnit, an Eclipse plugin to assist writing unit tests. Among other features, it lets you configure the default source folder of tests.
Kristoffer E
2010-08-22 20:51:37