Mikhail  Tsaplin
Mikhail Tsaplin

Reputation: 642

Configuring tests skip in deep modules structure

I have a structure of maven modules:

mavenProjectRoot/
  a/
    a1/
    a2/
  b/
    b1/
    b2/

And need to configure certain tests skipping in module a1 from root pom.xml.

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <excludes>
           <exclude>a/a1/**/*java</exclude>
        </excludes>
      </configuration>
    </plugin>
  </plugins>
</build>

But it seems my exclude expression is not correct, how to do that?

PS. I have created project sample

Upvotes: 0

Views: 42

Answers (1)

Iker Aguayo
Iker Aguayo

Reputation: 4115

If you want to skips the tests in a1 when you do "mvn test" from the root, you should write your snippet in a1 pom.xml with this modification:

<exclude>**/*.java</exclude>

But I recommend you to make two profiles in the root, one which runs all the tests and another which runs all the tests except the a1 tests.

Upvotes: 1

Related Questions