How to Edit an Publish-Task after Configuration Phase

I want to create an build.gradle.kts with multiple EntryPoints(Task’s) which all publish an different artifact to my artifactory.

My Problem is that the publishing-Task is configured at the Configuration Phase, but not acquired when actually executed.

publishing {
publications {
    create<MavenPublication>("buffer") {
        this.artifactId = project.ext.get("file").toString()
        this.version = project.ext.get("tempVersion").toString()
        val string: String ="pathToFile") as String
        val string2: String = project.ext.get("file") as String
repositories {
    maven {

As you can see the Path and the File itself is supposed to be gathert at execution, but is only acquired once.
Adding Placeholder-Entry’s in the External-Properties only enables me to successfully go through the Configuration Phase, but they are not updated again after that.

How do i actually get the right Entry’s at Execution-Time?