I am trying out the incubating new software model for building my Java project by going thought the documentation at https://docs.gradle.org/current/userguide/java_software.html
What I would like to do is have different external dependencies for different targetPlatforms. Something like,
model {
components {
main(JvmLibrarySpec) {
targetPlatform 'java7'
targetPlatform 'java8'
binaries.java7Jar {
dependencies {
compile group: 'xyz', name: 'dep7', version: '1.0'
}
}
binaries.java8Jar {
dependencies {
compile group: 'xyz', name: 'dep8', version: '1.0'
}
}
}
}
}
But it’s failing with the following error,
No signature of method: org.gradle.jvm.JarBinarySpec.dependencies() is applicable for argument types: ...
Any idea how to do this? Is it even possible?
Note: I don’t want to declare another project as a dependency, I want to download the dependency from an existing repository.