I should maybe explain a bit more what I plan to do. Perhaps there is a much simpler solution. With Maven I made quite good experience with the dependencyManagement feature. Which is for defining an external dependencies version in a central location. So all sub-modules use just the dependency without declaring its version.
With Gradle I currently do it by declaring a global map like this:
ext.modules = [
guiLib: module('org.myorg', 'gui-lib', '1.0'),
guiLibSources: module(''org.myorg', 'gui-lib', '1.0', 'sources'),
].asImmutable()
def module(String groupId, String artifactId, String version){
[group: groupId, name: artifactId, version: version].asImmutable()
}
def module(String groupId, String artifactId, String version, String classifier){
[group:groupId, name:artifactId, version:version, classifier:classifier].asImmutable()
}
But then I need to declare always all combinations, with/without classifier, with/without type. And we need it lots of times e.g. for GWT. So my plan is to create a plugin which takes a property file with module declarations like this:
guiLib: org.myorg:gui-lib:1.0
The classifier and type are specified when using it like this:
dependencies{
compile(
moduleKit.guiLib, //property provides the [group: 'org.myorg', name: 'guiLib', version: '1.0']
moduleKit.guiLib('sources') //method provides [group: 'org.myorg', name: 'guiLib', version: '1.0', classifier: 'sources']
}
}
This is what I need the invokeMethod and getProperty feature for.