【问题标题】:Running Jetty with instrumented files (cobertura)使用检测文件运行 Jetty (cobertura)
【发布时间】:2011-07-02 22:11:51
【问题描述】:

我有几个Selenium 测试并想知道它们的覆盖率(使用 Cobertura 测量)。我使用 Maven 2 作为构建框架。

在执行我的 Selenium 测试之前,我使用 mvn jetty:run 启动 Web 应用程序。

为了让覆盖率数据出现在我的报告中,我需要 Jetty 使用检测代码。

我可以使用mvn cobertura:instrument 显式检测代码。但是我怎样才能告诉 Jetty 使用检测代码(目录 target/generated-classes/cobertura)?

提前致谢

德米特里

【问题讨论】:

    标签: java maven-2 jetty cobertura


    【解决方案1】:

    在jetty-maven-plugin插件入口的配置元素中,可以指定元素,这会导致它使用不同的路径来查找类。

    如果您将以下内容添加到您的码头插件元素中,我认为您将开展业务:

    <classesDirectory>${basedir}/target/generated-classes/cobertura</classesDirectory>
    

    【讨论】:

    • 现在我在启动 Jetty 时遇到 java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented
    • 我猜 cobertura 罐子不在 jetty 的运行时类路径中。您是否能够追踪一个 cobertura 依赖项,您可以将其作为运行时依赖项放入您的 pom 中?
    • 我通过将 Cobertura 依赖项添加到 Jetty 插件配置来解决上述问题。现在我遇到了另一个异常:java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.TouchCollector.
    • 现在我解决了这个问题,这是由于错误的 Cobertura 版本造成的。
    • @DmitriPisarenko。很久以前,但你能分享你的解决方案代码吗?
    猜你喜欢
    • 1970-01-01
    • 2011-01-12
    • 2016-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-14
    • 2012-06-24
    • 2010-10-18
    相关资源
    最近更新 更多