How to define a configuration that is included with compile, but is separate?

(davidmichaelkarr) #1

I’m sure that subject line doesn’t make sense.

I’m building an app that has several dependencies. One, and only one, of those dependencies also needs to be separately installed into the container I’m deploying the app to.

So, my first guess was to define a “forContainer” configuration that extends from “compile”, and put that one dependency in that configuration, instead of “compile”. Also defined a “copyLibsForContainer” copy task that depends on “build”, and copies from “configurations.forContainer” to a subdirectory of "${buildDir}.

Boom. Worked fine. Except for the teeny problem that this copied ALL of the dependencies, not just the one. Duh. I defined “forContainer” to extend “compile”, so it got all of them.

It almost seems like I have to reverse it, defining the “compile” configuration to extend from “forContainer”. Logically that seems right, but not right.

What can I do here?

(davidmichaelkarr) #2

Hmm. Well, I found a simple solution. I determined that the dependency isn’t actually required at compile time, so I removed the dependency relationship, and now it copies exactly what it needs to copy.