Specify dependencies for separate sourceSets

In a project I have multiple sourceSets/source folders. Each sourceSet needs to be compiled but also needs to have separate dependencies:

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
  group = 'grpId'
version = '1.0'
  repositories {
    sourceSets {
 main {
  java {
   srcDir 'src'
 other {
  java {
   srcDir 'other'
  dependencies {
  // specify that the 'other' sourceSet should be compiled
  compile sourceSets.other.output
      // How to set dependency specific for the the 'main' and 'other' sourceSet?

How do I:

  1. Make sure both sourceSets are compiled - seems to work with the above approach

  2. Specify a dependency for the sourceSet ‘other’, eg. c:\repo\a.jar?

  3. Specify a dependency for the sourceSet ‘main’, eg. c:\repo\b.jar

This seems to do the trick:


But the sourceSet specific dependencies seems to be ignored when generating the .classpath using the gradle eclipse plugin:


It can’t be modeled in Eclipse. And it shouldn’t be necessary, because the smallest unit of compilation in Eclipse is the project.