Skip to content

Map Provider

jkschneider edited this page Nov 16, 2014 · 2 revisions

The map provider retrieves its recommendations from a plain java.util.Map instance hard coded into a project's Gradle script.

apply plugin: 'java'
apply plugin: 'nebula-dependency-recommender'

dependencyRecommendations {
   map recommendations: ['commons-logging:commons-logging': '1.2', 'com.google.guava:guava': '18.0']
}

Recursive variable definition, wildcard matches

dependencyRecommendations {
   map recommendations: [
	   'GUAVA_VERSION': '18.0',
	   'com.google.guava:guava': '$GUAVA_VERSION',
	   'some:other': '$com.google.guava:guava'
   ]
}

Technically, the provider does not distinguish between properties that are clearly "variables" (i.e. GUAVA_VERSION) and properties that are modules (i.e. some:other), but this has no impact. Notice in the example above that two substitutions are made by the plugin to come up with a some:other version of 18.0.