Passing another project's properties in multi project build to testNg test JVM


(Vikas Mallapura) #1

Hi,

I have a task in project A which produces a single string as output.

task aTask{

doLast{
project.ext {
bar = barValue.toString()
}
}
}

In project B, if i have the following definition:

task someTask(type: Test, dependsOn: [‘projectA:aTask’]) {

useTestNG() {
   ..
}
systemProperty 'foo', project("'projectA:aTask"].ext["bar"]

}

If i run projectB’s someTask, i get the following error:
Cannot get property ‘bar’ on extra properties extension as it does not exist

I tried adding the systemProperty in doFirst or doLast closures of project B which resolves the above error but the system property isn’t available to the testNg jvm.

Any work-arounds / solutions for this issue ?