How to put parameter into org.sonar.api.config.Settings from command line?

We use Upsource and SonarQube.
Upsource has plugin for integration with Sonar.
It needs some properties from pom file. One of them is sha of commit (sonar.upsource.revision).
So we want extract this property from pom to command line argument.

Upsource plugin implements PostJob and gets pom properties from org.sonar.api.config.Settings.

So, how we can put property sonar.upsource.revision into sonar plugin context dynamically (when run sonar:sonar)?

Upsource plugin

This may be a dumb suggestion, but have you tried passing -Dsonar.upsource.revision=the-value on the command line of mvn sonar:sonar ?

of course :slight_smile:

in that case plugin send error, that parameter missed

As you understand, we have source code for plugin and can change it to our needs.
Check link above, it uses Settings to get properties. So… what we can do with that?)


This @InstantiationStrategy(InstantiationStrategy.PER_TASK) looks suspicious. What if you try to remove it?

Note that this doesn’t really explain why the property would be missing.

It was my mistake, all works fine. Thanks.