You can use an ArtifactResolutionQuery
to manually resolve artifacts of a specific type:
def result = dependencies.createArtifactResolutionQuery()
.forModule('group', 'name', 'version')
.withArtifacts(JvmLibrary, MavenPomArtifact)
.execute()
for (component in result.resolvedComponents) {
component.getArtifacts(MavenPomArtifact).each { println it.file }
}
I'm not sure if the actual artifact will be resolved with this method, too, but you may just use the path of the POM file. Please note, that you should call this functionality during the execution phase, either by defining a new task type with a @TaskAction
or by using a doFirst
/doLast
closure.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…