Adding artifacts to ivy publication

Hi,

I am trying to publish two jars into a single ivy publication. (Gradle 6.8.3) I’ve noticed that as soon as I add the extra artifact into the publication along with the extra configuration, the dependencies of the java component are omitted. I digged into it and I can see that as soon as I start customizing the configurations the dependencies are omitted.

plugins {
  id("java-library")
}

publications {
  create<IvyPublication>("ivy") {
    organization = "foo"
    module = "bar"
    configurations {
      create("extra") {
        extend("runtime")
      }
    }
    from(components["java"])
    artifact("../some/extra/util.jar") {
      name = "baz"
      conf = "extra
    }
  }
}

I tried adding back manually all the configurations that are present if I don’t customize configurations (compile, runtime, default, etc.) but did not help.

Is there a way to keep the dependencies and add my extra configuration and extra artifact on top of that, without ruining the default behaviour?

I think this is a bug that has been discussed in older versions, looks like it crept back in 6.8.3 impossible to add source artifact when using java plugin with gradle 5 · Issue #8528 · gradle/gradle · GitHub

The suggested workaround helped me