Define Dependency using API instead of DSL


(post) #1

Dear all,

I tried to
define some dependencies by using the API instead of the DSL. I am looking for
an alternative for project-dependencies to artifacts with a classifier like
project(path: ‘core’, configuration:
‘sourceArtifacts’)
. I can
add a dependency to a certain configuration using the API with
project.dependencies.add(“myConfiguration”, project(“:core”)),
but this addresses the default artifact of the project “core”. But I don’t know
how to use the API so that the artifact with the classifier source will be addressed.

Attached
you find a small project with two subprojects: “core” and “customized”. “customized”
contains two tasks: copySource1 and copySource2. “copySource1” is using the DSL
and copies the artefact with the classifier “sources”. “copySource2” is using
the API and should copy the same artifact, but I don’t know how to use the API.

Can anybody
help or give a hint?

Kind Regards

Markus

sample.zip (8.7 KB)