Gradle:上课没有这样的财产?(Gradle: No such property for class?)

编程入门 行业动态 更新时间:2024-10-19 14:43:13
Gradle:上课没有这样的财产?(Gradle: No such property for class?)

我正在尝试使用最新版本的gradle编译现有代码库。 由于模块build.gradle文件中的以下行,构建失败:

project.setProperty("doNow", true)

有这个错误:

No such property: doNow for class: org.gradle.api.internal.project.DefaultProject_Decorated

我是否需要在导致错误的行之前在build.gradle中声明此属性?

来自setProperty gradle文档:

设置此项目的属性。 此方法在以下位置搜索具有给定名称的属性,并在找到该属性的第一个位置设置该属性。

I am trying to compile an existing codebase using the newest version of gradle. The build fails due to the following line in the modules build.gradle file:

project.setProperty("doNow", true)

with this error:

No such property: doNow for class: org.gradle.api.internal.project.DefaultProject_Decorated

Do I need to declare this property within build.gradle before the line causing an error?

From gradle docs for setProperty:

Sets a property of this project. This method searches for a property with the given name in the following locations, and sets the property on the first location where it finds the property.

最满意答案

尝试: project.ext.doNow = 'lol'

Try: project.ext.doNow = 'lol'

更多推荐

本文发布于:2023-08-05 06:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1428906.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:财产   Gradle   class   property

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!