2010-06-10 98 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