Hi,
my buildscript looks like this:
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility = 1.8
version = '1.0'
project.ext {
configDir = projectDir.getPath() + "/config"
scriptDir = projectDir.getPath() + "/scripts"
}
repositories { mavenCentral() }
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
}
}
task installApllication (dependsOn: subprojects.jar) {
copy {
from project(":sub1").configurations.runtime
into buildDir.getPath() + '/application/lib'
}
copy {
from project(":sub2").configurations.runtime
into buildDir.getPath() + '/application/lib'
}
copy {
from
subprojects.configDir
into buildDir.getPath() + '/application/config'
}
copy {
from
subprojects.scriptDir
into buildDir.getPath() + '/application'
}
copy {
from subprojects.jar.outputs
into buildDir.getPath() + '/application'
}
}
This executes all subproject.jar tasks and aggregates results in the parrent. The libs, scripts, and configs are copied just fine. But the .jar’s are not. They only get copied in the second pass through. So if i execute the task twice they get copied. But the older version of the jar is getting copied which means in a normal development process calling this will put me old jars into the folder. This means i have to execute it directly 2 times in a row to get the desired results.
At first I expected this should work but it seems like the jar.outputs is empty or old in the first pass and does not get updated due to the configurations lifecycles. Can anyone please help me with this? I tried putting the copies in a do last which results in the same behaviour. Also i wrapped the hole task in a doLast which is still the same.