Hello everyone!
I have a configuration called shadowRelocate
. Since I want to relocate them with the shadow plugin I wrote this little code:
shadowJar {
from sourceSets.main.output
from mainDirResources
classifier = null
version = jar.version
configurations = [project.configurations.shadow]
doFirst {
project.configurations.shadowRelocate.dependencies.each {
relocate(it.group, "${project.group}.shadow.${it.group}")
}
}
}
The only issue is that that doesn’t include transitive dependecies, which should be relocated too.
So I tried project.configurations.shadowRelocate.incoming.resolutionResult.allDependencies.each
. However, since getAllDependencies
doesn’t return a set of Dependcies but rather resolved dependencies, the method getGroup
is unknow and my code naturally doesn’t work.
project.configurations.shadowRelocate.resolvedConfiguration.resolvedArtifacts.each
didn’t work either. Has anyone an idea how I can realize this?