Maven 配置文件从不工作的包中排除 junit

问题描述

我有一个场景,我需要在编译期间将模块中的某些测试排除在运行之外。我使用的是 ma​​ven-surefire-plugin 版本 2.19.1。 我在该模块的 pom.xml 中创建了一个配置文件,如下所示,

<profiles>
        <profile>
            <id>excludeTests</id>
            <activation>
                <property>
                    <name>excludeTests</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.19.1</version>
                        <configuration>
                            <excludes>
                                <exclude>com/abc/def/MyPackage</exclude>
                            </excludes>

                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

在命令行中,我正在运行以下命令,

mvn clean test -DexcludeTests=true

'MyPackage' 下的 junit 类 仍在执行。这是什么问题。我的个人资料真的被选中了吗?请帮助我在构建时从这个包中排除 junit。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)