sonarqube5.6 - Using HttpConnector in a SonarQube plugin -
i'm trying develop sonarqube (compute engine) plugin , need use credentials (sonar.user // sonar.password) in order invoke web services within plugin itself.
i try declaring use of them in plugin class, e.g.:
@override public void define(plugin.context context) { ... context.addextensions(aslist( propertydefinition.builder(sonar_user) .name("sonar user") .description("sonarqube user") .onqualifiers(qualifiers.project) .type(propertytype.string) .defaultvalue("admin") .build() ... then in hook:
public class hook implements postprojectanalysistask { private final server server; private final settings settings; public hook(server server, settings settings) { this.server = server; this.settings = settings; } @override public void finished(projectanalysis projectanalysis) { final httpconnector httpconnector = httpconnector.newbuilder() .url(server.geturl()) .credentials( settings.getstring(ceplugin.sonar_user), // null settings.getstring(ceplugin.sonar_password) // null ).build(); final wsclient wsclient = wsclientfactories.getdefault().newclient(httpconnector); } } but when inject settings inside hook property not available.
how retrieve sonar.user , sonar.password can invoke web service api?
Comments
Post a Comment