Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20366

Expressing optional Java 11 dependencies in published metadata

$
0
0
implementation “com.sun.xml.bind:jaxb-impl:2.3.3”

What’s your approach of implementing JDK 11-specifics? I have a custom gradle file containing statements like the following:

if (JavaVersion.current().isJava8())
{
	return
}

dependencies
{
	compileOnly 'javax.annotation:javax.annotation-api:1.3.2'
}

An din build.gradle:

apply from:		'buildSrc/src/main/java/BuildByJdk11Workarounds.gradle'

Is this possible with the current version of Gradle? By declaring a variant of the default capability?

Did you already had a look at the official docs? Those sound to me like your goal could be reached by using Gradle Module Metadata:

https://docs.gradle.org/current/userguide/variant_model.html#sec:mapping-maven-ivy-to-variants
https://docs.gradle.org/current/userguide/component_metadata_rules.html

Crosspost:


Viewing all articles
Browse latest Browse all 20366

Trending Articles