Add a new dependency configuration that is used for a specific task

I am trying to set up an Android project, we have certain tests (tests A) that work differently than other tests (tests B) that require their own dependencies that cannot be included when running tests B.

I'm trying to add a new config that extends androidTestCompile with this code in my build.gradle file:

configurations {
    myTestCompile.extendsFrom('androidTestCompile');
}

      

By http://chimera.labs.oreilly.com/books/1234000001741/ch04.html#DEPENDENCY-CONFIGURATIONS It doesn't work, it gives me an error. Method not found extendsFrom () '.

Then I also don't know how to use specific configurations for the task.

Any help would be appreciated, regards.

+3


source to share


1 answer


First you have to declare the config.

configurations {
    myTestCompile
    myTestCompile.extendsFrom androidTestCompile
}

      

Edit



Then you can declare a test task that used this configuration.

task testB(type: Test) {
    classpath = configurations.myTestCompile
}

      

0


source







All Articles