SonarQube Eclipse插件:更改默认服务器配置

时间:2013-07-31 16:12:34

标签: sonarqube

我尝试在SonarQube Eclipse插件(v3.2)中更改默认的SonarQube服务器值...

使用pluginCustomization进程( eclipse.ini 文件中的参数-pluginCustomization myPrefs.ini),我添加了与eclipse首选项导出相同的值:

    # SonarQube default configuration server
    org.sonar.ide.eclipse.core/servers/http\:\\2f\\2fsonar.mycompany.org/auth=true

但创建工作区后,默认值始终为http://localhost:9000

这是一个错误吗?或者有一种最常用的方法吗?

感谢您的提示。

1 个答案:

答案 0 :(得分:0)

24/09/2015使用SonarQube Eclipse插件v3.5更新:修正(请参阅SONARCLIPS-428)。


这不是答案,而是一个技巧......如果你考虑:

  • 在Eclipse发行版中拥有自己的带有IStartup进程的插件
  • 您正在使用与SonarQube
  • 具有相同凭据的代理

此代码可以帮助您使用earlyStartup()方法:

// Plugin dependencies : org.sonar.ide.eclipse.core, org.eclipse.core.net

// Write a process to do this code once (IEclipsePreferences use)
// ...

String userName = null;
String password = null;

// Get first login/password defined in eclipse proxy configuration
BundleContext bc = Activator.getDefault().getBundle().getBundleContext();
ServiceReference<?> serviceReference = bc.getServiceReference(IProxyService.class.getName());
IProxyService proxyService = (IProxyService) bc.getService(serviceReference);
if (proxyService.getProxyData() != null) {
    for (IProxyData pd : proxyService.getProxyData()) {
        if (StringUtils.isNotBlank(pd.getUserId()) && StringUtils.isNotBlank(pd.getPassword())) {
            userName = pd.getUserId();
            password = pd.getPassword();
            break;
        }
    }
}

// Configure SonarQube with url and proxy user/password if exist
SonarCorePlugin.getServersManager().addServer("http://sonarqube.mycompany.com", userName, password);

// Store process done in preferences
// ...
相关问题