gpt4 book ai didi

gradle - 如何将命令传递给includeproject的build.gradle

转载 作者:行者123 更新时间:2023-12-03 05:37:51 24 4
gpt4 key购买 nike

我需要将“build -x test”之类的命令传递给包含的项目,该怎么做?
任何提示都将受到欢迎! ,目前没有-x测试,如下所示

plugins {
id "com.gradle.build-scan" version "1.6"
}

apply plugin: 'eclipse'

defaultTasks 'build'

//gradle build -Pfast=true
task build{
if(project.findProperty('fast')&&project.findProperty('fast').toLowerCase()=='true') {
println "#### build fast### " + project.findProperty('fast')
gradle.includedBuild('another-project').task(':build')
}else{
println "#### build normally###"
dependsOn gradle.includedBuild('another-project').task(':test')
dependsOn gradle.includedBuild('another-project').task(':build')
}
}

task clean{
dependsOn gradle.includedBuild('another-project').task(':clean')
}

task test{
dependsOn gradle.includedBuild('another-project').task(':clean')
dependsOn gradle.includedBuild('another-project').task(':test')
}

最佳答案

以下wordaround将解决我的问题

workingDir '../another-project'
commandLine 'gradle', 'build' ,'-x' ,'test'

关于gradle - 如何将命令传递给includeproject的build.gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54807248/

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