testReport destinationDir 在 gradle 7.4.2 中已弃用,那么如何设置它?
task<TestReport>("testReport") {
destinationDir = file("$buildDir/reports/allTests")
}
这显然已被弃用,但在这种情况下,弃用消息对我来说没有意义。我现在应该如何设置这个值?
/**
* Sets the directory to write the HTML report to.
*
* <strong>This method will be {@code @Deprecated} soon, please use {@link #getTestResults()} instead to access the new collection property.</strong>
*/
public void setDestinationDir(File destinationDir) {
DeprecationLogger.deprecateProperty(TestReport.class, "destinationDir").replaceWith("destinationDirectory")
.willBeRemovedInGradle8()
.withDslReference()
.nagUser();
getDestinationDirectory().set(destinationDir);
}
task<TestReport>("testReport") {
destinationDir = file("$buildDir/reports/allTests")
}
This is apparently deprecated, but the deprecation message doesn't make sense to me in this context. How am I actually supposed to set this value now?
/**
* Sets the directory to write the HTML report to.
*
* <strong>This method will be {@code @Deprecated} soon, please use {@link #getTestResults()} instead to access the new collection property.</strong>
*/
public void setDestinationDir(File destinationDir) {
DeprecationLogger.deprecateProperty(TestReport.class, "destinationDir").replaceWith("destinationDirectory")
.willBeRemovedInGradle8()
.withDslReference()
.nagUser();
getDestinationDirectory().set(destinationDir);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
$buildDir
也已被弃用,但好消息是您可以使用test-report-aggregation
插件收集所有子项目的测试报告。在 Gradle 8.5 中,我从父
build.gradle
中删除了以下代码片段:并创建了一个单独的子项目,例如 test-results,其中包含以下
build .gradle
:$buildDir
has also been deprecated but the good news is that you can collect all your subproject's test reports usingtest-report-aggregation
plugin.In Gradle 8.5, I've removed the following snippet from my parent
build.gradle
:and created a separate subproject, say test-results, with the following
build.gradle
:请这样尝试。
较旧版本:
最新版本:
它对我有用。希望它对您有用。谢谢
Please try like this.
Older version:
With latest version:
It worked for me. Hope it'll work for you. Thanks