我们已经在Android Kotlin项目中实现了Jacoco,我们可以通过在本地调用。/gradlewclean build jacocoTestReport
但是,当我们部署到VSTS / Azure DevOps时,会出现以下错误:
2019-02-04T09:37:35.5760285Z BUILD SUCCESSFUL in 12s
2019-02-04T09:37:35.5760428Z 1 actionable task: 1 executed
2019-02-04T09:37:35.5801607Z SYSTEMVSSCONNECTION exists true
2019-02-04T09:37:35.5816653Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\vstsagent\A1\_work\2\s\ApolloClient\gradlew.bat clean build jacocoRootReport"
2019-02-04T09:37:36.7652264Z
2019-02-04T09:37:36.7653533Z FAILURE: Build failed with an exception.
2019-02-04T09:37:36.7653767Z
2019-02-04T09:37:36.7653947Z * Where:
2019-02-04T09:37:36.7654401Z Build file 'C:\vstsagent\A1\_work\2\s\ApolloClient\build.gradle' line: 44
2019-02-04T09:37:36.7654582Z
2019-02-04T09:37:36.7654768Z * What went wrong:
2019-02-04T09:37:36.7654952Z A problem occurred evaluating root project 'ApolloClient'.
2019-02-04T09:37:36.7655191Z > Could not find method jacocoTestReport() for arguments [build_abtyecjstjhjqmdmcxnlw2kq0$_run_closure4$_closure8@50246031] on project ':app' of type org.gradle.api.Project.
2019-02-04T09:37:36.7655365Z
2019-02-04T09:37:36.7655547Z * Try:
2019-02-04T09:37:36.7655747Z Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
2019-02-04T09:37:36.7655931Z
2019-02-04T09:37:36.7656098Z * Get more help at https://help.gradle.org
2019-02-04T09:37:36.7656242Z
2019-02-04T09:37:36.7656585Z BUILD FAILED in 1s
2019-02-04T09:37:37.1999815Z Error: C:\vstsagent\A1\_work\2\s\ApolloClient\gradlew.bat failed with return code: 1
2019-02-04T09:37:37.1999996Z at ChildProcess.<anonymous> (C:\vstsagent\A1\_work\_tasks\Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4\2.143.2\node_modules\vsts-task-lib\toolrunner.js:639:25)
2019-02-04T09:37:37.2000102Z at emitTwo (events.js:106:13)
2019-02-04T09:37:37.2000154Z at ChildProcess.emit (events.js:191:7)
2019-02-04T09:37:37.2000226Z at maybeClose (internal/child_process.js:886:16)
2019-02-04T09:37:37.2000286Z at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
我不明白的是,它是否正在寻找名为 jacocoRootReport 或 jacocoTestReport 的任务?
最佳答案
我无法获得创建报告的实际gradle流程,因此找到了解决方法
关于kotlin - 在适用于Android的Azure DevOps中运行JaCoCo:找不到方法jacocoTestReport(),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54514585/