首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何避免使用'mvn site‘运行surefire单元测试

如何避免使用'mvn site‘运行surefire单元测试
EN

Stack Overflow用户
提问于 2013-11-02 19:41:12
回答 2查看 1.3K关注 0票数 3

每当我运行'mvn site‘时,我所有的surefire单元测试都会被执行。有没有办法避免在运行mvn站点时运行surefire单元测试。我的pom如下所述。我在父项目中使用了下面的pom,所有的模块都是这个pom的子模块。

代码语言:javascript
复制
<plugins>
    <!--For Unit tests -->
    <plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${surefire.version}</version>
    </plugin>
    <!--For executing Integration tests in integration-test phase -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>${failsafe.version}</version>
    <configuration>
        <excludes>
        <exclude>**/*Test.java</exclude>
        </excludes>
        <includes>
        <include>**/*IT.java</include>
        </includes>
    </configuration>
    <executions>
        <execution>
        <phase>integration-test</phase>
        <goals>
            <goal>integration-test</goal>
            <goal>verify</goal>
        </goals>
        </execution>
    </executions>
    </plugin>
</plugins>
<!--For generating unit and integration test reports -->
<reporting>
    <plugins>
    <plugin>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.7</version>
        <reportSets>
        <reportSet>
            <reports>
            <!--Disable all default reports -->
            </reports>
        </reportSet>
        </reportSets>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>${surefire.version}</version>
        <configuration>
        <aggregate>true</aggregate>
        <linkXRef>true</linkXRef>
        </configuration>
    </plugin>
    </plugins>
</reporting>
EN

回答 2

Stack Overflow用户

发布于 2018-06-05 03:28:30

根据插件documentation,使用report-only

代码语言:javascript
复制
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-report-plugin</artifactId>
    <version>${surefire.version}</version>
    <reportSets>
        <reportSet>
            <reports>
                <report>report-only</report>
            </reports>
        </reportSet>
    </reportSets>
</plugin>

surefire-report:report-only:创建一个格式良好的html格式的Surefire测试报告。此目标不运行测试,它只构建报告。这是https://issues.apache.org/jira/browse/SUREFIRE-257的一种解决方法

票数 1
EN

Stack Overflow用户

发布于 2013-11-02 20:35:25

尝试使用mvn -DskipTests=true site

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19741525

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档