在我的build.gradle中,我有一个像这样的属性:
sourceSets {
mtp {
resources {
exclude '**/*.html'
}
}
}
是否可以通过命令行获取mtp的属性?我可以获得根项目的属性:
gradle properties
sourceSets: [source set 'main', source set 'mtp', source set 'test']
但是当我尝试以下操作时,它会失败:
gradle sourceSets:properties
Project 'sourceSets' not found in root project.
我的解决方案总是为此目的创建一个特定的新任务:
task mtp {
sourceSets.mtp.properties.each {println it}
}
但是,我需要一个更简单实用的解决方案。有什么意见吗?
谢谢。
最佳答案
当前没有内置功能可从命令行发现嵌套属性。构建语言/模型的更好的可发现性是3.0的计划功能。在此之前,Gradle Build Language Reference是回答此类问题的最佳信息来源。