How to pass a system property to gradle with the jenkins gradle plugin?
Asked Answered
R

1

9

I have a gradle tasks that deploys some stuff to bintray using curl.

For this to work it needs my bintray api key. I don't want to put that in my build script (or a property file) since all this stuff is hosted in plain sight at github.

Instead I made the task use a property named bintrayApikey which is to be provided when calling gradle. When I run it locally using

gradlew pushToBintray -DbintrayApikey=<my api key>

everything works as intended.

So the next step is to make this work from my Jenkins over at cloudbees. Since there doesn't seem to be a special place for putting system properties I just added them to the tasks, but this does not seem to work. In the console I can see it is accessing bintray all right, but then finishes with:

This resource requires authentication 

So how can I provide the property value in my jenkins job configuration?

Roush answered 3/4, 2013 at 8:19 Comment(0)
G
12

Use -Pmyprop instead of -Dmyprop.

The Gradle Jenkins Plugin accepts parameters with -P.

-D is for java parameters.

Gonfanon answered 4/4, 2013 at 22:3 Comment(1)
Thx that worked! Can you give a hint to why it works, or especially why -D works locally but not on the jenkins?Roush

© 2022 - 2024 — McMap. All rights reserved.