有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何从xml报告生成cobertura html报告

我想从cobertura xml报告生成一个cobertura html报告。Jenkins Cobertura插件似乎可以做到这一点,但我不知道怎么做。我尝试了以下方法,但它只生成html报告的一部分(取自CoberturaPublisher.java):

Set<String> sourcePaths = new HashSet<String>();
CoverageResult result = null;
try {
    result = CoberturaCoverageParser.parse(coberturaXmlReport, null, sourcePaths);
} catch (IOException e) {
    LOG.warn(format("Failed parse report %s", coberturaXmlReport.getAbsoluteFile()));
}

if (result != null) {
    result.setOwner(null);
    final FilePath paintedSourcesPath = new FilePath(new File(destinationDir)).child("html");
    paintedSourcesPath.mkdirs();
    // Get System default encoding;
    SourceEncoding encoding = SourceEncoding.getEncoding(System.getProperty("file.encoding"));
    OutputStream os = new FileOutputStream("XmlToHtml.log");
    BuildListener listener = new StreamBuildListener(os);
    SourceCodePainter painter = new SourceCodePainter(paintedSourcesPath, sourcePaths, result.getPaintedSources(), listener, encoding);
    final FilePath moduleRoot = new FilePath(new File(destinationDir));

    moduleRoot.act(painter);
}

我错过什么了吗


共 (0) 个答案