微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。