0

我尝试更改 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

这是一个错误?或者有一个最好的常用方法来做到这一点?

感谢您的提示。

4

1 回答 1

0

2015 年 9 月 24 日更新:使用 SonarQube Eclipse 插件 v3.5 修复(请参阅SONACLIPS -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
// ...
于 2013-08-07T16:01:45.583 回答