Skip to content

Instantly share code, notes, and snippets.

@ghale
Created September 27, 2022 19:33
Show Gist options
  • Save ghale/8ffdff4756ac4e48e5fe414c86dfcad0 to your computer and use it in GitHub Desktop.
Save ghale/8ffdff4756ac4e48e5fe414c86dfcad0 to your computer and use it in GitHub Desktop.
Custom metadata rule to select a specific minor version of a library
repositories {
mavenCentral()
}
configurations {
foo
}
dependencies {
foo 'org.scala-lang:scala-library:latest.2_12'
foo 'org.scala-lang:scala-reflect:2.12.8'
}
@CacheableRule
abstract class CustomStatusRule implements ComponentMetadataRule {
void execute(ComponentMetadataContext context) {
if (context.details.id.name == 'scala-library'
&& context.details.id.version.startsWith('2.12.')) {
context.details.statusScheme = ["release", "2_12"]
context.details.status = "2_12"
}
}
}
dependencies {
components {
all(CustomStatusRule)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment