gpt4 book ai didi

android - 在根项目中找不到任务

转载 作者:太空狗 更新时间:2023-10-29 13:51:40 25 4
gpt4 key购买 nike

我被gradle build lifecycle搞糊涂了几天。 Refer告诉我

A Gradle build has three distinct phases.

  • Initialization
  • Configuration
  • Execution

创建任务是在第三步吗?如果是,gradle如何找到一个项目对象中的所有任务

这是一个例子。

 rootporject
|----app
|----build.gradle
|----checkstyle.gradle

build.gradle 和平常一样简单。checkstyle.gradle 文件有一个任务。这是它的内容。

apply plugin: 'checkstyle'

task checkstyle(type:Checkstyle) {
description 'Runs Checkstyle inspection against girl sourcesets.'
group = 'Code Quality'
configFile rootProject.file('checkstyle.xml')
ignoreFailures = false
showViolations true
classpath = files()
source 'src/main/java'
}

./gradlew -q tasks之后,没有任务checkstyle

但如果我将定义删除到 build.gradle 中,我就明白了

有什么问题吗?提前致谢。

编辑

来自 doc

There is a one-to-one relationship between a Project and a build.gradle file.

最佳答案

您还没有应用其他脚本。

在您的 build.gradle 中,您应该添加一个 apply from: 'checkstyle.gradle'

关于android - 在根项目中找不到任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46219916/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com