Take a look at the pom file for your dependency. The transitive dependency uses maven profiles to pull in the OS specific jar.
Gradle does not have full support of maven profile activation. See this old blog on how Gradle deals with consuming Maven dependencies that rely on profiles. Gradle can support:
Profiles that are active by default.
Profiles that are active on the absence of a system property.
Unfortunately, the library you are pulling uses OS activation. I suspect that is the reason. I’m not aware of a workaround other than manually adding the transitive dependency.
You can use if conditions to add the correct dependency based on the os.name and os.arch system properties. See example.
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
dependencies {
def os = DefaultNativePlatform.currentOperatingSystem
def arch = DefaultNativePlatform.currentArchitecture
def jvmbrotli = "0.2.0"
api "com.nixxcode.jvmbrotli:jvmbrotli:$jvmbrotli"
switch (true) {
case os.windows && arch.i386:
api "com.nixxcode.jvmbrotli:jvmbrotli-win32-x86:$jvmbrotli"
break
case os.windows && arch.amd64:
api "com.nixxcode.jvmbrotli:jvmbrotli-win32-x86-amd64:$jvmbrotli"
break
case os.macOsX && arch.amd64:
api "com.nixxcode.jvmbrotli:jvmbrotli-darwin-x86-amd64:$jvmbrotli"
break
case os.linux && arch.amd64:
api "com.nixxcode.jvmbrotli:jvmbrotli-linux-x86-amd64:$jvmbrotli"
break
default:
println "No suitable driver of Brotli found for current " +
"OS (${os.displayName}) and architecture (${arch.displayName}). "
}
}
Well, that means you are using Gradle internal classes which can break anytime, even with a minor version increase. I’d strongly suggest you use the Ant class instead.