I have a simple project with a custom sourceSet.
src
├── main
│ ├── java
│ │
│ └── resources
├── example
│ ├── java
│ │
│ └── resources
│
└── test
├── java
└── resources
I want to add dependencies only to the example sourceSet. Is this not possible? I have the below build file:
sourceSets {
example
}
dependencies {
exampleCompile 'org.apache.commons:commons-lang3:3.7'
// compile 'org.apache.commons:commons-lang3:3.7'
}
As it turns out, if I uncomment the compile 'org.apache.commons:commons-lang3:3.7'
line, the commons lang dependency becomes available in the example sourceSet. I don’t seem to be able set this dependency to be only available on the example sourceSet without having to define the compile dependency as well. In fact, once I define a compile dependency, specifying it at exampleCompile
level becomes unnecessary.
I think I am missing a big piece of knowledge here. Appreciate any help.