java - Gradle:类没有这样的属性?

标签 java groovy gradle

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

project.setProperty("doNow", true)

出现此错误:

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

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

来自 setProperty 的 gradle 文档:

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'

关于java - Gradle:类没有这样的属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33782426/

相关文章:

java - 使用 ClassTag 获取包含泛型类型

java - WSO2 EI - 构建直通流时出现 RelayUtils 错误

jenkins - 使用 Jenkins Pipeline 脚本,从并行步骤访问全局变量是否安全?

java - Gradle 下载源码依赖

java - 当前正在运行的Activity的调用函数

java - GWT Gin 异步服务注入(inject)

configuration - Gradle使用文件结构拆分测试任务

grails - Groovy 1.8.6使用了不正确的元类方法

android - 无法使用模块编译项目

java - Gradle 总是从任何任务中执行 println