Maven 2 emma不生成报告,但cobertura生成报告?

Maven 2 emma不生成报告,但cobertura生成报告?,maven-2,cobertura,emma,Maven 2,Cobertura,Emma,将这两个问题进行比较的基本原因是,在pom的build部分中放入以下插件信息后,我能够在site目录(forcobertura)中生成报告。但同样的情况不会发生在艾玛身上。我在codehause mojo中查看了文档,这两个版本几乎相同。我的配置是: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>emma-maven-plugin&

将这两个问题进行比较的基本原因是,在pom的build部分中放入以下插件信息后,我能够在site目录(for
cobertura
)中生成报告。但同样的情况不会发生在
艾玛身上。我在codehause mojo中查看了文档,这两个版本几乎相同。我的配置是:

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

org.codehaus.mojo
EmmaMaven插件
1.0-α-2
进程类
艾玛

但它不会像预期的那样在站点目录中生成报告,但我可以看到每次生成的coverage.em和检测的类。我是否缺少任何配置

我无法重现你的问题。我将您的配置片段复制并粘贴到一个随机的
pom.xml
中,并运行
进程类之后的任何阶段
触发器,并按预期生成覆盖率报告:

$ 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] ------------------------------------------------------------------------ $mvn清洁流程类 [信息]正在扫描项目。。。 [信息]------------------------------------------------------------------------ [信息]建筑测试项目 [信息]任务段:[清理,流程类] [信息]------------------------------------------------------------------------ [信息][清除:清除{执行:默认清除}] [信息]删除目录/home/pascal/tmp/test project/target [信息][资源:资源{执行:默认资源}] [信息]使用“UTF-8”编码复制筛选的资源。 [信息]正在复制1个资源 [信息][编译器:编译{执行:默认编译}] [INFO]正在将1个源文件编译为/home/pascal/tmp/test project/target/classes [信息]准备艾玛:艾玛 ... EMMA:运行时覆盖率数据合并到[/home/pascal/tmp/test project/coverage.ec]{in 93 ms} [信息][emma:emma{execution:default}] 正在处理输入文件。。。 在3毫秒内读取并合并2个文件 正在将[xml]报告写入[/home/pascal/tmp/test project/target/site/emma/coverage.xml]。。。 正在将[html]报告写入[/home/pascal/tmp/test project/target/site/emma/index.html]。。。 [信息]------------------------------------------------------------------------ [信息]构建成功 [信息]------------------------------------------------------------------------ 你的项目中有单元测试吗?
coverage.em
文件是否非空?如果在命令行上运行
emma:emma
,会发生什么?使用
-X
选项运行mvn会给您任何提示吗?你能发布一些有用的线索吗


顺便说一句,我个人不会将
emma:emma
作为常规构建的一部分运行。我要么从命令行运行
emma:emma
目标,要么按照页面中的建议配置插件和报告部分。但这是另一个故事,并没有回答这个问题。

这真的很奇怪:更正的插件条目是:查看输出目录

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

org.codehaus.mojo
EmmaMaven插件
1.0-α-2
真的
艾玛
进程类
艾玛
${project.build.directory}
emma甚至不接受${project.build.directory}/emma


结论:当您将任何子目录添加到${project.build.directory}时,emma不会生成报告,例如${project.build.directory}/emma报告。

包含在右侧?嘿,Pascal,非常感谢您的关注。是的,我有单元测试和覆盖率。em不是空的。看看下面我错过了什么。但仍然看着你的踪迹它奇怪的行为。我注意到的是,一个是输出目录,但你说你只是复制粘贴的代码,另一个是我正在运行“干净安装”。不知道是怎么回事。@RN是的,我用了“原样”这个片段。我刚刚用mvn clean install进行了测试,得到了相同的结果。您的pom是否从另一个pom继承(我的不是)。它从父项目继承。${basedir}已被弃用,使用${project.basedir}和${basedir}/target总是不好,使用${project.build.directory}(目标/类使用${project.build.outputDirectory})嗨,我也遇到同样的问题,您能给我一些建议吗。[INFO]