简体   繁体   English

jenkins上的emma代码覆盖范围未创建报告

[英]emma code coverage on jenkins is not creating reports

I am trying to generate code coverage reports using emma on jenkins, however it is failing 我正在尝试在詹金斯上使用emma生成代码覆盖率报告,但是失败了

Builds are successful. 构建成功。 It is only the emma reports that are failing. 仅Emma报告失败。

Here is my pom.xml 这是我的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>ThinClientManager</groupId>
    <artifactId>ThinClientManager</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>ThinClientManager</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <included.packages>-Dincluded.packages=hob.tcm</included.packages>
        <included.adapters>-Dincluded.adapters=coverage,complexity,dependency</included.adapters>
    </properties>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source />
                        <target />
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <inherited>true</inherited>
                    <configuration>
                        <forkMode>once</forkMode>
                        <argLine>-javaagent:serenity/serenity.jar -Xms512m -Xmx1024m ${included.packages} ${included.adapters}</argLine>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>emma-maven-plugin</artifactId>
                <version>1.0-alpha-3</version>
                <inherited>true</inherited>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>surefire-report-maven-plugin</artifactId>
                <inherited>true</inherited>
            </plugin>
        </plugins>
    </reporting>


    <repositories>
        <!--other repositories if any -->
        <repository>
            <id>project.local</id>
            <name>project</name>
            <url>file:${project.basedir}/repo</url>
        </repository>
    </repositories>



    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>ant</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>EAAdmin</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>hlset</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>hlsetutil</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>tool</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>xstream</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
</project>

Here is my output 这是我的输出

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'emma'.
[INFO] ------------------------------------------------------------------------
[INFO] Building ThinClientManager
[INFO]    task-segment: [emma:emma]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing emma:emma
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 15 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [emma:instrument {execution: default-instrument}]
[INFO] Instrumenting classes with EMMA
processing instrumentation path ...
ERROR: Could not find local repository for 2.2.1
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] com.vladium.emma.EMMARuntimeException
/usr/share/tomcat6/.jenkins/jobs/Workplace Job System (Maven)/workspace/target/generated-classes/emma/classes/hob/props/.svn/prop-base/log.properties.svn-base (Permission denied)
[INFO] ------------------------------------------------------------------------
[INFO] Trace
com.vladium.emma.EMMARuntimeException: com.vladium.emma.EMMARuntimeException
    at com.vladium.emma.instr.InstrProcessorST.handleFile(InstrProcessorST.java:567)
    at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:193)
    at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
    at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
    at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
    at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
    at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumeratePathDir(IPathEnumerator.java:177)
    at com.vladium.util.IPathEnumerator$Factory$PathEnumerator.enumerate(IPathEnumerator.java:97)
    at com.vladium.emma.instr.InstrProcessorST._run(InstrProcessorST.java:715)
    at com.vladium.emma.Processor.run(Processor.java:88)
    at org.codehaus.mojo.emma.task.InstrumentTask.execute(InstrumentTask.java:106)
    at org.codehaus.mojo.emma.EmmaInstrumentMojo.doExecute(EmmaInstrumentMojo.java:158)
    at org.codehaus.mojo.emma.AbstractEmmaMojo.execute(AbstractEmmaMojo.java:98)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1038)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:643)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:65)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at hudson.maven.agent.Main.launch(Main.java:205)
    at hudson.maven.MavenBuilder.call(MavenBuilder.java:154)
    at hudson.maven.Maven2Builder.call(Maven2Builder.java:79)
    at hudson.maven.Maven2Builder.call(Maven2Builder.java:55)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:701)
Caused by: java.io.FileNotFoundException: /usr/share/tomcat6/.jenkins/jobs/Workplace Job System (Maven)/workspace/target/generated-classes/emma/classes/hob/props/.svn/prop-base/log.properties.svn-base (Permission denied)
    at java.io.RandomAccessFile.open(Native Method)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:236)
    at com.vladium.emma.instr.InstrProcessorST.writeFile(InstrProcessorST.java:815)
    at com.vladium.emma.instr.InstrProcessorST$FileWriteJob.run(InstrProcessorST.java:882)
    at com.vladium.emma.instr.InstrProcessorST.drainJobQueue(InstrProcessorST.java:943)
    at com.vladium.emma.instr.InstrProcessorST.addJob(InstrProcessorST.java:929)
    at com.vladium.emma.instr.InstrProcessorST.handleFile(InstrProcessorST.java:562)
    ... 47 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Mon Apr 14 13:45:41 CEST 2014
[INFO] Final Memory: 21M/50M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /usr/share/tomcat6/.jenkins/jobs/Workplace Job System (Maven)/workspace/pom.xml to ThinClientManager/ThinClientManager/0.0.1-SNAPSHOT/ThinClientManager-0.0.1-SNAPSHOT.pom
channel stopped
Skipping Emma coverage report as mojo did not run.
Finished: FAILURE

My jenkins configuration is as follows: 我的詹金斯配置如下:

Build 建立

Root POM - pom.xml 根POM-pom.xml

Goals and options - emma:emma 目标和选项-emma:emma

and i have added the "Record Emma Coverage Report" Post-Build Action, however it is still empty. 并且我添加了“记录Emma覆盖率报告”的生成后操作,但是它仍然为空。 I did not add the archive artifacts post-build action. 我没有在构建后添加归档工件。

I think you have multiple problems here. 我认为您在这里有多个问题。 I'll start by saying that you should not use Serenity for code coverage and Emma at the same time, enhancing the byte code twice is never a good idea. 首先,您不应同时使用Serenity进行代码覆盖和Emma,将字节码两次增强并不是一个好主意。 Note that I wrote the Serenity code coverage Jenkins plugin. 请注意,我写了Serenity代码覆盖率Jenkins插件。

From the exception it looks like you started Tomcat with user root, then with another user, and Jenkins can't access the directories that it wants to. 从例外情况来看,您似乎是用root用户启动Tomcat,然后又用另一个用户启动的,而Jenkins无法访问它想要的目录。 Probably best to chown the entire directory $TOMCAT_INSTALL and ~/.jenkins to the user that you want to use. 最好将整个目录$ TOMCAT_INSTALL和〜/ .jenkins整理给您要使用的用户。 Then give it another shot. 然后再试一试。

Cheers, Michael 干杯,迈克尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM