Dependencies from build project to code

I’m probably going about this in the wrong way, so do educate me…

I have the following projects in a flat multi project build:

master  (root project)
build (is a distribution project)
code  (Java project)

The build project is where all the distribution stuff occurs - OS X app built, Launch4j EXE built and signed, RPMs built, etc etc.

How do I configure build such that a change to code will mean it is rebuilt when I run installDist in build?

At the moment, I have to explicitly build the code project first, then call installDist.

The reason this happens is that the libs etc are brought in using the project API and grabbing the runtime configuration for code. It’s important that build does not have a compile dependency on code because to do so screws up the operation of the various distribution tasks.

For example, in build’s build.gradle:

configurations {

dependencies {
    code project(":code")

distributions {
    main {
        contents {
            from(configurations.code.files) {
            	into "lib"

configurations.code.files resolves at configuration time, which is causing your trouble. Just do configurations.code instead.

1 Like

Easy as that - thanks!