13

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.

orbfish
  • 7,381
  • 14
  • 58
  • 75
  • 1
    The question you linked is how to run the tests - I'm asking a different question, how to mark the test directories. Please take the time to read the question before you close it! – orbfish Jul 31 '15 at 22:41
  • Maybe this one then? http://stackoverflow.com/questions/19205767/include-new-test-directory-maven-surefire-plugin either way, we've seen this before – tim_yates Aug 01 '15 at 07:36
  • in the build tag - just add testSourceDirectory - src/test/java – Ashish Shetkar Apr 04 '18 at 12:03

1 Answers1

10

As described at http://maven.apache.org/ref/3.3.3//maven-model/maven.html#class_build the build section of the pom.xml has an entry to specify the test folder.

Gangnus
  • 24,044
  • 16
  • 90
  • 149
Robert Scholte
  • 11,889
  • 2
  • 35
  • 44