Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the default test location in Eclipse when using Maven?

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.

like image 504
GaryF Avatar asked Aug 03 '10 10:08

GaryF


1 Answers

Good question, this bothers me too. I googled it and found this suggestion: 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.

like image 111
K Erlandsson Avatar answered Sep 19 '22 14:09

K Erlandsson