Gradle project with custom source set

Answered

I have added a gradle with custom sourceset/configuration. While IDEA recognized this new source folder when I imported the project, it still does not recognize the dependencies that were added and IntelliJ shows them as compilation errors.

sourceSets {
integrationTest {
java {
srcDir "src/integration-test/java"
}
resources {
srcDir "src/integration-test/resources"
}
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}


And dependencies defined like

integrationTestCompile "com.github.springtestdbunit:spring-test-dbunit:1.2.1"

However I get an error when I build : 

Error:(12, 35) java: package com.github.springtestdbunit does not exist

Works correctly in gradle when I do

gradle compileIntegrationTestJava

 

 

8 comments
Comment actions Permalink

I rather not. Last time I tried an EAP, I got burnt.

0
Comment actions Permalink

Does this mean - this is a known issue ?

0
Comment actions Permalink

It's rather stable RC build that will become a release in less than 2 weeks. See http://blog.jetbrains.com/idea/2016/02/intellij-idea-16-public-preview/ .

The IntelliJ IDEA project model is finally aligned with that of Gradle and supports custom source sets by resolving dependencies between individual ones. This improvement fixes a great number of issues that have been reported by our users.

0
Comment actions Permalink

Tried : Yes, Result : Not good.

This problem was solved, but now when I run tests from the IDE, the Launcher$AppClassLoader is not finding resources in my tests (src/test/resources). Any suggestion ?

Also performance wise , 16 RC 1 fares poorer than the previous edition (or it may be my perception)

0
Comment actions Permalink

Have you refreshed the project from gradle (using 'Refresh' button from gradle tool window) after switch to idea 16?

0
Comment actions Permalink

Ok, that worked after I refreshed. 

Thanks

0

Please sign in to leave a comment.