Default configuration name (artifacts) in composite build dependency

Hello.

I’ve been staring at it for a while, but can’t figure it out – looking for enlightenment.

I have a composite project (“includeBuild” in settings.gradle) with a dependency on the subproject (implementation ‘org.foo:baz:1.0’). Now, I this included ‘baz’ subproject should only extend the ‘base’ plugin (not anything fancier) and create a custom artifact that is then available in the parent build. The baz subproject has this:

plugins {
  id 'base'
}

group "org.foo"
version "1.0"

task createDistro(type: Copy) {
  from file("file.txt")
  into 'build/distro'
  rename { String fileName ->
    fileName.replace("file.txt", "file-subproject.txt")
  }
}

assemble.dependsOn(createDistro)

artifacts {
  archives file("build/distro/file-subproject.txt")
}  

the produced artifact is not visible in the parent build (which collects its dependencies into a folder). I’m doing something wrong here because if I change the subproject and make it a ‘java-library’ the produced JAR is visible to the parent project.

The code for this is at https://github.com/dweiss/gradle-experiment3

Running:

 ./gradlew assemble
 ls build/dependencies

should list artifacts exposed from org.foo:baz:1.0, but it currently doesn’t.

Any clues?

Ok, replying to myself here. The problem is that a dependency on an included build uses the default configuration and the base plugin, by default, doesn’t make the default configuration to extend the archives.

Adding:

configurations {
  it.default.extendsFrom archives
}

fixes the problem; unless it’s still not the “right” way to do it, in which case feedback is welcome.