Reputation: 5620
src
main/java
test/java
The test does not depend on main for compiling. Tying to compile and run test on another library replacing main.
sourceSets {
remove main
}
gradle test
It will always compile the main source set.
Upvotes: 1
Views: 3078
Reputation: 841
You can try sourceSets.remove(sourceSets.main)
as sourcesets {}
delegates to https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/SourceSetContainer.html
Upvotes: 2