我需要将“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/