How to specify test directory in Maven pom.xml

时间:2015-07-31 20:52:59

标签: maven unit-testing groovy pom.xml

Maven handles java unit tests well by defaulting to:

src/test/java

We're writing quite a few Groovy unit tests right now, and I'd like to find a way in Maven to specify a folder such as:

src/test/groovy

as a test folder. This would help us to import a Maven project into, say, IntelliJ, without additional setup.

Someone mentioned this was possible, but I wasn't able to find a way searching the Maven docs, or SO. Does anyone know how to mark the directory in the pom?

Thank you

Update: I am not asking how to run the tests in Maven! The tests are already running fine. I'm asking how to mark the directories as test directories in Maven.

1 个答案:

答案 0 :(得分:6)

http://maven.apache.org/ref/3.3.3//maven-model/maven.html#class_build所述,pom.xml的build部分有一个条目来指定测试文件夹。