Hi,
we have projects with dependencies to other projects that generates multiple jar files with
different classifiers. Usually the dependencies are defined by module versions. For example:
dependencies {
compile mygroup:mylib-a:1.0.0-SNAPSHOT
compile mygroup:mylib-b:1.0.0-SNAPSHOT
compile mygroup:mylib-b:1.0.0-SNAPSHOT:api
}
When working on these projects we would like to replace the dependencies by project references of
a multi-project build like:
compile project (':mylib-a')
compile project (':mylib-b')
compile project (path:':mylib-b', configuration:'api')
We don’t want to change the version controlled build file every time. So the replacement is done by
dependency substitution:
configurations.all {
resolutionStrategy.dependencySubstitution.all { DependencySubstitution dependency ->
if (dependency.requested instanceof ModuleComponentSelector) {
def targetProject = findProject(":${moduleName}")
if (targetProject != null) {
dependency.useTarget targetProject
}
}
}
}
But the problem is that the ModuleComponentSelector has no attribute ‘classifier’. Is there any
other way to retrieve the classifier of a dependency substitution?
Also how can we choose a configuration with DependencySubstitution.useTarget?
Greetings
Christoph