简体   繁体   中英

gradle project dependency in idea

I have configuration in one subproject(A) that produce test artifact:

configurations {
    testArtifacts.extendsFrom testRuntime
}
task testJar(type: Jar) {
    classifier "test"
    from sourceSets.test.output
}
artifacts {
    testArtifacts testJar
}

and in another subproject(B) I want to use that artifact:

compile project (path: ":a-sub-project", configuration: 'testArtifacts')

this works perfectly fine from gradle, but when I import project to idea(through built-in support), idea can't see classes from that artifact. It can see classes from main artifact of (A), but not from test one.

Any ideas?

PS. Idea 14.1.4, gradle 2.3.

For us this works fine:

testCompile project(':module').sourceSets.test.output

So you don't need the test-jar task actually

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM