如何获得生成的maven-surefire-report-plugin的图标

问题描述 投票:4回答:2

我正在使用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>

缺少与图像一起显示报告的内容?

maven report surefire
2个回答
13
投票

这个问题可能太旧了,但是我遇到了同样的问题,并且发现了this answer。命令mvn site -DgenerateReports=false仅为surefire-report.html生成CSS和图像,并且可以正常工作。


0
投票

我是这样做的,但这是一个技巧:

<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>
© www.soinside.com 2019 - 2024. All rights reserved.