Junit4 i TestNG w jednym projekcie z Maven

Aby je uruchomić, dostępnych jest kilka opcji, ale wybrałem różne profile dla Junit i TestNG. Ale teraz problem polega na wykluczeniu i uwzględnieniu przypadków testowych.

Ponieważ jeśli dodamy zależność testNG do głównego projektu w Maven, pominie to cały Junit, postanowiłem umieścić go w osobnym profilu. Wykluczam więc testy TestNG w domyślnym (głównym) profilu z kompilacji za pomocą następującego wpisu w pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.0.2</version>
        <configuration>
        <source>1.5</source>
        <target>1.5</target>
        <testExcludes>
            <testExclude>**/tests/**.*</testExclude>
            <testExclude>**/tests/utils/**.*</testExclude>
        </testExcludes>
    </configuration>
</plugin>

i to samo dla pewnej wtyczki. Działa dobrze z profilem głównym i wykonuje tylko testy Junit4. Ale kiedy używam profilu testNG, nie wykona testu testNG, nawet jeśli go nie skompiluje. Używam następującego profilu do ich wykonania.

<profile>
    <id>testNG</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    <testIncludes>
                        <testInclude>**/tests/**.java</testInclude>
                        <testInclude>**/tests/utils/**.*</testInclude>
                    </testIncludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>false</skip>
                    <includes>
                        <include>**/**.class</include>
                        <include>**/tests/utils/**.class</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>5.8</version>
            <scope>test</scope>
            <classifier>jdk15</classifier>
        </dependency>
    </dependencies>
</profile>

Czy ktoś ma pojęcie, dlaczego nie włącza ich i nie kompiluje ponownie?

questionAnswers(3)

yourAnswerToTheQuestion