我在build.gradle文件中添加了一些依赖项,如下所示
ext {
boxableVersion = '1.5.bq'
}
dependencies {
implementation group: "com.github.dhorions", name:'boxable', version:${boxableVersion}
}在我将JDK版本从1.8更改为11之前,这是无缝工作的。
无法使用Gradle发行版“https://services.gradle.org/distributions/gradle-6.0-bin.zip”运行分阶段构建操作。构建文件'/home/christine/christine/projectsFromGit/pdfcreator/build.gradle‘行: 43一个评估根项目'pdfcreator’的问题发生了。无法在类型为build_4fl1snfk49qgbmumnf1gg989h$_run_closure3$_closure11@d7c9f2a的对象上找到参数org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.的方法$()
如果我直接给出像这样的版本,这个项目正在成功地构建。
implementation group: "com.github.dhorions", name:'boxable', version:'1.5.bq'我怎样才能像以前那样在外部提供版本呢?
发布于 2020-05-06 20:02:43
依赖项声明中的下列语法version:${boxableVersion}无效。它与JDK版本无关,只是${...}在Gradle DSL或Groovy语法中没有任何意义。
如果您想在'ext‘属性中定义版本,则可以使用version: boxableVersion直接引用该属性(ext属性通过"groovy魔术“在脚本中直接可用),或者可以使用串内插标记(请注意双引号")。
version: "${boxableVersion}"或者,以更简单的方式:
implementation "com.github.dhorions:boxable:${boxableVersion}"发布于 2020-05-07 02:20:09
就试着:
ext {
boxableVersion = '1.5.bq'
}
dependencies {
implementation group: "com.github.dhorions", name:'boxable', version:"${boxableVersion}"
}https://stackoverflow.com/questions/61638858
复制相似问题