如何在Gradle中使用初始化脚本配置jacocoTestReport

问题描述

我正在尝试扩展现有的build.gradle,以便它更新jacocoTestReport,以便生成XML报告,因为SonarQube现在需要这些报告

// allprojects {
// initscript {
rootProject {
  plugins {
    id 'jacoco'
  }
  //apply plugin: 'jacoco'
  jacocoTestReport {
    reports {
      xml.enabled = true
      html.enabled = true
    }
  }
}

我尝试使用./gradlew -I jacoco.gradle check,但出现类似错误

Could not find method plugins() for arguments [init_4poyb2mng02b0u77g0shf960p$_run_closure1$_closure2@1821f380] on root project 'template-ms' of type org.gradle.api.Project.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)