2010-06-10 63 views
2

把這兩個比較問題放在這兩個之間的基本原因是在我的pom的build部分放入以下插件信息後,我可以在站點目錄(對於cobertura)生成報告。但emma不會發生同樣的情況。我檢查了codehause mojo中的文檔,兩者幾乎相同。我的配置是:emma不生成報告,但cobertura呢?

<plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>emma-maven-plugin</artifactId> 
      <version>1.0-alpha-2</version> 
      <executions> 
       <execution> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>emma</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

但不生成報告,預計將在網站目錄,但我可以看到coverage.em產生和類儀器每次。我是否缺少配置?

+0

包含在對不對? – JoseK 2010-06-10 11:27:23

+0

不,它在。 – ravinikam 2010-06-10 12:49:32

回答

0

這真的很奇怪:修正插件項是:看到輸出目錄

<plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>emma-maven-plugin</artifactId> 
      <version>1.0-alpha-2</version> 
      <inherited>true</inherited> 
      <executions> 
       <execution> 
        <id>emma</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>emma</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <outputDirectory>${project.build.directory}</outputDirectory> 
      </configuration> 
     </plugin> 

艾瑪甚至不接受$ {} project.build.directory /艾瑪。

結論:當您向$ {project.build.directory}添加任何子目錄時,emma不生成報告,例如, $ {} project.build.directory /艾瑪的報告。

+0

$ {basedir}已棄用,請使用$ {project.basedir}並且$ {basedir}/target總是很糟糕,對於target/classes使用$ {project.build.directory}(和$ {project.build.outputDirectory}) – 2010-06-10 21:53:13

+0

謝謝seanizer – ravinikam 2010-06-11 06:41:12

+0

嗨我也有同樣的問題,你可以給我一些建議。[INFO] <<< emma-maven-plugin:1.0-alpha-3:emma(default-cli)<[emma] test @ point- repo <<< [INFO] [INFO] --- emma-maven-plugin:1.0-alpha-3:emma(default-cli)@ point-repo --- 處理輸入文件... 1個文件(s)在2毫秒內讀取和合並 無關:沒有在任何數據文件中找到運行時覆蓋數據它不會生成任何報告文件。 – Sajithv 2015-03-11 10:30:21

1

我無法重現您的問題。我複製並粘貼您的配置片段注入隨機pom.xml和運行的任何階段後,以process-classes觸發emma:emma和預期產生覆蓋報告:

 
$ mvn clean process-classes 
[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Test Project 
[INFO] task-segment: [clean, process-classes] 
[INFO] ------------------------------------------------------------------------ 
[INFO] [clean:clean {execution: default-clean}] 
[INFO] Deleting directory /home/pascal/tmp/test-project/target 
[INFO] [resources:resources {execution: default-resources}] 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 1 resource 
[INFO] [compiler:compile {execution: default-compile}] 
[INFO] Compiling 1 source file to /home/pascal/tmp/test-project/target/classes 
[INFO] Preparing emma:emma 

... 

EMMA: runtime coverage data merged into [/home/pascal/tmp/test-project/coverage.ec] {in 93 ms} 
[INFO] [emma:emma {execution: default}] 
processing input files ... 
2 file(s) read and merged in 3 ms 
writing [xml] report to [/home/pascal/tmp/test-project/target/site/emma/coverage.xml] ... 
writing [html] report to [/home/pascal/tmp/test-project/target/site/emma/index.html] ... 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESSFUL 
[INFO] ------------------------------------------------------------------------ 

你有你的項目單元測試? coverage.em文件是否爲空?如果在命令行上運行emma:emma,會發生什麼情況?運行mvn與-X選項給你任何提示?你可以發佈一些有用的痕跡嗎?

作爲一個方面說明,我不會運行emma:emma作爲定期編譯的一部分。我要麼從命令行運行emma:emma目標,要麼按照Usage頁面中的建議配置插件和報告部分。但這是另一回事,並沒有回答這個問題。

+0

嘿帕斯卡感謝你的興趣。是的,我確實有單元測試和coverage.em不是空的。看下面我失蹤了。 – ravinikam 2010-06-10 13:46:55

+0

但仍然看着你的蹤跡它的奇怪的行爲。我注意到的是,一個是輸出目錄,但你說你只是複製粘貼我的代碼,另一個是我正在運行'乾淨安裝'。不要有什麼事情。 – ravinikam 2010-06-10 13:58:43

+0

@RN是的,我使用了片段「原樣」。我剛剛用'mvn clean install'進行了測試,並得到了相同的結果。你的pom是否從另一個繼承(我的不)。 – 2010-06-10 14:11:05