2010-12-10 16 views
1

生成されたサイトに確実なレポートが表示されるのが少し難しかったです。私はmvn clean site:siteを実行し、レポートが欠落しています。生成されたサイトからMaven Surefireレポートが見つかりません

私のpom.xmlは、次のようになります - 私はMVNテストを行うと、テストが正常に実行さ

<?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</project.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> 

$ 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] ------------------------------------------------------------------------ 

私がここで間違っていることを知ってもいいですか?ありがとう。

答えて

4

(maven-surefire-pluginの代わりに)レポートセクションでmaven-surefire-report-pluginを使用する必要があります。

<reporting> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-report-plugin</artifactId> 
      <version>2.6</version> 
     </plugin> 
    </plugins> 
</reporting> 
関連する問題