Set project properties via buildship


(Thomas) #1

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 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.

(uklance) #2

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"] 

(Donát Csikós) #3

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:

(Thomas) #4

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

(Donát Csikós) #5

I’m glad you could find the solution.