开发者

Maven Surefire Report Missing from Generated Site

I'm having a little difficulty in getting the surefire report to appear in the generated site. I run mvn clean site:site and the report is missing.

My pom.xml looks like this:-

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>testMaven</groupId>
    <artifactId>testMaven</artifactId>
    <name>Test Maven Project</name>
    <version>1.0</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</proj开发者_StackOverflow社区ect.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.6</version>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.6</version>
            </plugin>
        </plugins>

    </reporting>
</project>

When I do mvn test, the test runs fine.

$ mvn clean test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Test Maven Project
[INFO]    task-segment: [clean, test]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory c:\workspace\java\rsa\testMaven\target
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to c:\workspace\java\rsa\testMaven\target\classes
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 1 source file to c:\workspace\java\rsa\testMaven\target\test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: c:\workspace\java\rsa\testMaven\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running testMaven.main.HelloWorldServiceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Dec 10 10:42:20 CST 2010
[INFO] Final Memory: 17M/1016M
[INFO] ------------------------------------------------------------------------

May I know what I'm doing wrong here? Thanks.


You need to use the maven-surefire-report-plugin in the reporting section (instead of the maven-surefire-plugin), e.g.

<reporting>   
    <plugins>   
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>   
            <version>2.6</version>   
        </plugin>   
    </plugins>   
</reporting>   
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜