I end with this solution

List<MavenCoordinates> dependencies = new ArrayList<>()


variant.getCompileConfiguration().resolvedConfiguration.lenientConfiguration.allModuleDependencies.each
 {
    ResolvedDependency dependency ->
        try {
            dependency.getModuleArtifacts().each { ResolvedArtifact artifact ->
                MavenCoordinates newDep = new 
MavenCoordinatesImpl(dependency.moduleGroup, dependency.moduleName,
                        dependency.moduleVersion, artifact.type, 
artifact.classifier)

                if (!dependencies.contains(newDep)) {
                    dependencies.add(newDep)
                }
            }
        } catch (Exception ex) {
            // no-op
        }
}


try ... catch is nost best solution, but getModuleArtifacts(), will crash 
for example on project module dependencies.
Instead of try catch is maby possible to use dependency.getConfiguration().

I don't call this in configuration phase, but iside of my task.

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to