Gradle引用其他单元测试

1. ProjectA build.gradle

task testsJar(type: Jar, dependsOn: testClasses) {
    classifier = 'tests'
    from sourceSets.test.output
}

configurations {
    tests
}

artifacts {
    tests testsJar
    archives testsJar
}

jar.finalizedBy(testsJar)

2. ProjectB build.gradle

dependencies {

  compile project(':projecta')

  testCompile project(path: ':projecta', configuration: 'tests')

}

猜你喜欢

转载自www.cnblogs.com/chenzhaoyu/p/11041536.html