api / org.gradle.api.artifacts.query

Package org.gradle.api.artifacts.query

Types

ArtifactResolutionQuery

interface ArtifactResolutionQuery

A builder to construct a query that can resolve selected software artifacts of the specified components.

 apply plugin: 'java' task resolveCompileSources { doLast { def componentIds = configurations.compile.incoming.resolutionResult.allDependencies.collect { it.selected.id } def result = dependencies.createArtifactResolutionQuery() .forComponents(componentIds) .withArtifacts(JvmLibrary, SourcesArtifact, JavadocArtifact) .execute() for (component in result.resolvedComponents) { component.getArtifacts(SourcesArtifact).each { println "Source artifact for ${component.id}: ${it.file}" } } } }