2

我有以下问题:

maven-surefire-report-plugin 调用生命周期目标test。这再次启动了我的测试运行程序。为了防止这种情况,他们做了这个解决方法:http: //jira.codehaus.org/browse/SUREFIRE-257

我现在在将它实施到我的 POM 中时遇到了困难。他们在页面上有以下注释:

注意:从 2.8 版开始,此插件需要 Maven Site Plugin 2.1 或更高版本才能正常工作。2.7.2 及更早的版本仍与较新的surefire 版本兼容,因此可以混合使用。

我的 Maven 运行:“clean deploy site-deploy”

这是我的 POM 部分:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <configuration>
        <reportPlugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                            <report>dependencies</report>
                            <report>project-team</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <outputDirectory>${project.build.directory}/site</outputDirectory>
                    <reportsDirectories>
                        <reportsDirectories>${project.build.directory}/site/surefire-reports</reportsDirectories>
                    </reportsDirectories>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.3</version>
            </plugin>
        </reportPlugins>
        <generateReports>true</generateReports>
        <inputEncoding>UTF-8</inputEncoding>
        <outputEncoding>UTF-8</outputEncoding>
    </configuration>
</plugin>

如何配置仅surefire-report:report-only触发test且不调用 -phase 的它(但其他一切都在site-phase 中完成)?

4

1 回答 1

2

After searching the internet for a few hours and some things I finally found out how.

The goal has to be the report, like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-report-plugin</artifactId>
    <version>2.9</version>
    <configuration>
        <outputDirectory>${project.build.directory}/site</outputDirectory>
        <reportsDirectories>
            <reportsDirectories>${project.build.directory}/site/surefire-reports</reportsDirectories>
        </reportsDirectories>
    </configuration>
    <reportSets>
        <reportSet>
            <id>integration-tests</id>
            <reports>
                <report>report-only</report>
            </reports>
        </reportSet>
    </reportSets>
</plugin>
于 2014-05-14T12:15:39.450 回答