Make one source set dependent on another

后端 未结 2 754
执笔经年
执笔经年 2021-02-18 21:58

I have an integration test source set in gradle, and it is dependent on my main classes being compiled. I set that up by doing

integrationTestClasses.dependsOn \         


        
2条回答
  •  无人共我
    2021-02-18 22:31

    It is also possible to establish the dependency chain when defining the sourceSets. This worked to setup the "main" sourceSet to depend on a "generated" sourceSet:

    // Default sourceSets already created by the java plugin: src/main and src/test
    // Default content for each sourceSet: /java and /resources
    sourceSets {
        // Adding src/generated
        generated
        // Setting src/main to depend on the dependencies and output of src/generated
        main {
            compileClasspath += generated.compileClasspath + generated.output
        }
    }
    

    The same principle should work to setup "integrationTest" to depend on "main".

提交回复
热议问题