Gradle.properties with dynamic properties

I want to define a gradle property such as below in gradle.properties. newWorkdDir=${buildDir}/newWork dbUrl=“jdbc:h2:mem:${rootProject.name}-db;INIT=SET SCHEMA APPLICATION_USER”

In few test resource files, I am referring to this newWorkdDir for replacement. actualWorkdDir=${newWorkdDir}

processTestResources() task is not able to replace to populate actualWorkdDir with ${buildDir}/newWork expansion. Instead I see it as “${buildDir}/newWork”. How do I make it expand the value when processing resources? Same is the scenario for dbUrl. In resource files that refer to dbUrl, I dont get the expanded value.

figured out… below code resolved my query. expand(project.properties) was the key

allprojects {
    processTestResources {
        include '**/*.properties'
        include '**/*.xml'
          org.apache.tools.ant.Project tempAntProject = new org.apache.tools.ant.Project()
        project.properties.each { k, v ->
            v instanceof String && tempAntProject.setProperty(k,v)
        }
        filter(ExpandProperties, project : tempAntProject )
        expand(project.properties)
    }
}

thanks for sharing your solution with us