0

I am new to sonar plugin development. I wrote a plugin and add PropertyDefine to context. And then I wanna get my property value passed by

gradle sonarqube -Dmy.proper.name=xxx

I don't know what are the next steps? Plz help. Thanks.

Rocky
  • 1,287
  • 3
  • 15
  • 37

2 Answers2

0

All -D parameters can be get by using java.lang.System class:

String valueOrNull = System.getProperty("my.proper.name");

or

String valueOrDefault = System.getProperty("my.proper.name", "defaultValue");
agabrys
  • 8,728
  • 3
  • 35
  • 73
0

Hi @agabrys thanks for your answer. But I found out that if you wanna get the property from Scanner side, you need make a PostJob like class to deal with it. I didn't clearly know that so I didn't know why I couldn't get that property. Thanks anyway.

Rocky
  • 1,287
  • 3
  • 15
  • 37