2

我想知道是否有返回 SourceSet 完整路径字符串或文件目录的属性,例如${project.projectDir}/src/${sourceSet.name}.

apply plugin: 'java'

sourceSets {
    foo {
        java {
            srcDir 'example/dir/java'
        }
    }
}

// For example, this could return pathToProject/src/example/dir
println sourceSets.foo.srcDir
4

1 回答 1

2

尝试这个:

productFlavors {
    admin { }
    customer { }
}

sourceSets {
    main {
        java.srcDirs = ['src/main']
        //other typical sourceSets stuff
    }

    admin.java.srcDirs = ['src/admin']
    customer.java.srcDirs = ['src/customer']
}
于 2018-07-07T04:22:49.443 回答