【问题标题】:How to get the icons for the resulted maven-surefire-report-plugin如何获取生成的 maven-surefire-report-plugin 的图标
【发布时间】:2014-02-21 08:23:09
【问题描述】:

我正在使用 maven-surefire-report-plugin 来生成单元测试报告。 这工作正常,但是报告包含指向未显示的图像的链接。 如何让 Maven 复制报告所需的图标? 我应该使用皮肤吗?我试过了但没有成功。 这是 maven-surefire-report-plugin 的定义:

 <reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.16</version>
            <configuration>
                <showSuccess>true</showSuccess>
            </configuration>
        </plugin>

    </plugins>
</reporting>

我尝试添加皮肤插件但不影响报告:

 <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-site-plugin</artifactId>
       <dependencies>
           <dependency>
               <groupId>org.apache.maven.skins</groupId>
               <artifactId>maven-application-skin</artifactId>
               <version>1.0</version>
           </dependency>
       </dependencies>
 </plugin>

用图片展示报告缺少什么?

【问题讨论】:

  • 您能否展示一个不符合您需求的示例报告?
  • 报告没问题。它只是不显示链接的图像。例如:icon_error_sml.gif icon_success_sml.gif

标签: maven report surefire


【解决方案1】:

这个问题可能太老了,但我遇到了同样的问题,我找到了this answer。 命令mvn site -DgenerateReports=false 只为surefire-report.html 生成css 和图像并且工作正常。

【讨论】:

    【解决方案2】:

    您必须使用Site Plugin 生成站点:

    mvn site
    

    如果您已经生成了报告,那么您可以跳过这一步来加快速度:

    mvn site -DgenerateReports=false
    

    【讨论】:

      【解决方案3】:

      mvn 站点 -DgenerateReports=false

      【讨论】:

        【解决方案4】:

        我是这样做的,但这是一个 hack:

        <build>
            <plugins>
                ...
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire.version}</version>
                    <configuration>
                        <testSourceDirectory>src/test/java</testSourceDirectory>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>${maven-surefire.version}</version>
                    <configuration>
                        <linkXRef>false</linkXRef>
                        <showSuccess>true</showSuccess>
                    </configuration>
                    <executions>
                        <execution>
                            <id>generate-test-report</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
            <resources>
                <resource>
                    <directory>${project.basedir}/src/test/resources/css</directory>
                    <targetPath>${project.build.directory}/site/css</targetPath>
                    <includes>
                        <include>*.css</include>
                    </includes>
                </resource>
            </resources>
        </build>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-07-02
          • 2019-01-14
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-02-05
          相关资源
          最近更新 更多