Set project properties via buildship

Is there any way to set project properties for a Gradle launch via the Buildship UI?

I would really like to configure a few different Gradle build run configurations which run the same tasks using different -P values so I could launch from a single click or hotkey via eclipse instead of having to edit a gradle.properties file each time.

I thought the Program Arguments textbox of the Arguments tab of the run configuration would allow this, but it seems to treat them incorrectly as task names.

Are the set of -P values limited? You could create a task for each. Eg

['A', 'B', 'C'].each {
   task(type: MyRunner, "run$it") {
      args = [it, "foo", "bar"] 
      ... 
   } 
} 

This should work as you expected: if you specify -Pfoo=bar as a program argument then project.getProperty('foo') should return bar during the build. Maybe you encountered the problem that spaces are not handled properly: https://github.com/eclipse/buildship/issues/624

Just tried it again, and success. I must have had an extra space or something. Thanks.

I’m glad you could find the solution.