This question is similar to Make one source set dependent on another
Besides the main SourceSet, I also have testenv SourceSet. The code in testenv SourceSet refers to the main code, so I need to add the main SourceSet to the testenvCompile configuration.
sourceSets { testenv } dependencies { testenvCompile sourceSets.main }
This does not work because you cannot directly add source elements as dependencies. Recommended way to do this:
sourceSets { testenv } dependencies { testenvCompile sourceSets.main.output }
But this does not work correctly with eclipse, because when I clean the gradle build folder, eclipse no longer compiles, since it depends on the gradle build. Also, if I change the main code, I will have to rebuild the project in gradle for the changes to take effect in eclipse.
How do I declare dependencies correctly?
EDIT:
it
sourceSets { testenv } dependencies { testenvCompile files(sourceSets.testenv.java.srcDirs, sourceSets.testenv.resources.srcDirs) }
works for the main source, but since I am now linking to .java files, I miss the generated classes from Annotation-Processor :(
source share