samedi 2 décembre 2017

Maven won't run tests from parent project

I got a multi-module project. Each project has its own unittest same for the parent project. When I use mvn test no tests are run and the target folder does not contain any test classes. Parent project doesn't even create a target folder

Structure looks like this:

|-module1-> pom.xml
|-module2-> pom.xml
|-module3-> pom.xml
|-src/main
|-src/test/java/Mytest.java
|-pom.xml

See poms below ( I omited standard pom boilerplate)

parent pom.xml

<groupId>com.tests</groupId>
<artifactId>unit-tests</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
    <module>module1</module>
    <module>module2</module>
    <module>module3</module>
</modules>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
        <version>RELEASE</version>
    </dependency>
<dependencies>

Child pom has:

<parent>
    <groupId>com.tests</groupId>
    <artifactId>unit-tests</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>

Whenever i run mvn clean test no tests are run and in the console i get something like:

[INFO] ------------------------------------------------------------------------
[INFO] Building unit-tests 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------

Btw, parent project does not have any source code, just tests

Aucun commentaire:

Enregistrer un commentaire