You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Pucheng Yang (Jira)" <ji...@apache.org> on 2022/02/19 22:29:00 UTC

[jira] [Comment Edited] (SUREFIRE-2018) Tests not excluded when dependency label used within the plugin

    [ https://issues.apache.org/jira/browse/SUREFIRE-2018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17495060#comment-17495060 ] 

Pucheng Yang edited comment on SUREFIRE-2018 at 2/19/22, 10:28 PM:
-------------------------------------------------------------------

[~tibordigana] Thanks for the response. I haven't so I just looked into the links you shared. However, I still can't tell why I can't exclude the test. I want to share more info about this. Once I removed surefire-testng dependency, such as below
{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}
Then I can get what I need. I am not sure if I miss something about surefire-testng so I read about [https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html] but found nothing. May I ask if I miss something?

 


was (Author: JIRAUSER285498):
[~tibordigana] Thanks for the response. I haven't and I just looked into the links you shared. However, I still can't tell why I can't exclude the test. I want to share more info about this. Once I removed surefire-testng dependency, such as below
{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}
Then I can get what I need. I am not sure if I miss something about surefire-testng so I read about [https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html] but found nothing. May I ask if I miss something?

 

> 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
>            Priority: Major
>
> 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)