Pucheng Yang created SUREFIRE-2018:
--------------------------------------

             Summary: Tests not excluded when dependency label used within the 
plugin
                 Key: SUREFIRE-2018
                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2018
             Project: Maven Surefire
          Issue Type: Bug
          Components: Maven Surefire Plugin
    Affects Versions: 3.0.0-M5
            Reporter: Pucheng Yang


Hi there, I found a strange issue for me, not sure if it is a bug or I did 
something wrong. Could you help me take a look? thanks.

I am trying to exclude a test when working on a open source project 
(https://github.com/trinodb/trino/blob/master/core/trino-main/pom.xml#L489), 
here is the original plugin definition
{code:java}
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <dependencies>
        <!-- allow both JUnit and TestNG -->
        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit-platform</artifactId>
            <version>${dep.plugin.surefire.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-testng</artifactId>
            <version>${dep.plugin.surefire.version}</version>
        </dependency>
    </dependencies>
</plugin> {code}
to exclude certain tests, this is what I do
{code:java}
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <dependencies>
        <!-- allow both JUnit and TestNG -->
        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit-platform</artifactId>
            <version>${dep.plugin.surefire.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-testng</artifactId>
            <version>${dep.plugin.surefire.version}</version>
        </dependency>
    </dependencies>
    <configuration>
        <excludes>
            <exclude>**/TestFileSingleStreamSpillerFactory.java</exclude>
        </excludes>
    </configuration>
</plugin>{code}
However, when I run maven test, this test is not excluded. I tried commented 
out the dependency part, and I can exclude it.
{code:java}
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
<!--                <dependencies>-->
<!--                    &lt;!&ndash; allow both JUnit and TestNG &ndash;&gt;-->
<!--                    <dependency>-->
<!--                        <groupId>org.apache.maven.surefire</groupId>-->
<!--                        <artifactId>surefire-junit-platform</artifactId>-->
<!--                        <version>${dep.plugin.surefire.version}</version>-->
<!--                    </dependency>-->
<!--                    <dependency>-->
<!--                        <groupId>org.apache.maven.surefire</groupId>-->
<!--                        <artifactId>surefire-testng</artifactId>-->
<!--                        <version>${dep.plugin.surefire.version}</version>-->
<!--                    </dependency>-->
<!--                </dependencies>-->
                <configuration>
                    <excludes>
                        
<exclude>**/TestFileSingleStreamSpillerFactory.java</exclude>
                    </excludes>
                </configuration>
            </plugin> {code}
I wonder did I miss something? thanks.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to