Issues with project specific behavior(object-attribute) definition called for in subprojects


(Aswin Prakash Thiyagarajan) #1

Setting of property in project specific closure not taking effect in task defined in subprojects.

Project Structure: parent-child1-(child11,child12)

parent build file --------------------

allprojects {

Obj obj = new Obj()

//obj.setVals()

//for n attributes }

child1 build file ----------------- subprojects.each { project.evaluationDependsOn(it.name) }

subprojects{ task packageAsRpm(type: Rpm){

project.ext.artifact = archivePath } }

configuration{

newOne }

dependencies {

newOne …external dependency… }

artifacts{

newOne file: archivePath, name: ‘my-artifact’, type: ‘text’, builtBy: generate }

uploadNewOne{

…ivy upload… } }

project(‘child1’) {

obj.setSomething(someValue) //of the same object used instantiated in allprojects }

— I guess I’m going wrong somewhere. Been trying to fix this issue for couple of days. Not getting it. Could I get some help on this?


(Luke Daley) #2

It’s not clear what you’re trying to achieve and how the code doesn’t achieve it.

Also, you can wrap code in <code> tags to get better formatting that is much easier to read.