Is there any best practice on using Composite Build and EAR Plugin

Hello,

we build our EAR file using the deploy configuration to add an EJBs.jar into the root of the EAR.
As this is not transitive, we add the dependencies of the EJBs project by building a special EJB-dependencies.jar and including it using the earlib configuration. The special JAR we simply generate by using an empty jar tasks and assign the classifier “dependencies” to the publication (in the same project as EJBs)

dependencies {
  deploy ('myGroup:EJBs:1.0')
  earlib ('myGroup:EJBs:1.0:dependencies')
}

Unfortunately, this doesn’t work with composite builds (as noted here https://docs.gradle.org/current/userguide/composite_builds.html#included_build_substitution_limitations)

But how to solve this issue? One option is to create a true project EJBs-dependencies which consists only the dependencies and is used a compile dependencies by EJBs project and in the earlib configuration.

I’m not very pleased with this solution as it introduces a new project without concrete meaning.
We are also trying to use EJBs directly in the earlib configuration and “substract” the EJBs.jar from the lib directory, but until now we didnt manage to do so.

Is there any simplier and cleaner way to do this?

Thank you in advance.

In fact, the issue is indirectly solved with Gradle 4.7 (see #3535 at https://docs.gradle.org/4.7/release-notes.html), such that no intermediate dependencies-Artifact is no longer required.