Read element from the list do all the actions of the task for each element

I am taking the element from the itemList and passing it to below function when Type is Normal.It should take first element and then tag all the repos one by one and go for next element and tag all repos. The problem here is it is tagging only the repo with the last element of the itemList.Could you please let me know how could I fix this?

   itemList = "abc,def"

      Type.Normal -> {
           findProperty("itemList")?.let {
            it.toString().split(",").forEach { module ->
              tasks.withType<SomeKotlinTagTask>().configureEach {
                p.set("$test ${project.test.testVersion}")
                p.set(repo.br)
            }
          }
        }
      }

You are iterating over a list of items, and then writing each item to the same property. So the next value will overwrite the previous one.

I am not sure what you are trying to do here without more context, but maybe you can set the “tag” value to the full list, or add (not set) them one by one? In either case, the “tag” property should probably be a ListProperty.