do {
removedKeys.clear();
for (PluginInfo plugin : pluginInfosByKeys.values()) {
+ if (!plugin.isCompatibleWith(server.getVersion())) {
+ throw MessageException.of(String.format(
+ "Plugin %s [%s] requires at least SonarQube %s", plugin.getName(), plugin.getKey(), plugin.getMinimalSqVersion()));
+ }
+
if (!Strings.isNullOrEmpty(plugin.getBasePlugin()) && !pluginInfosByKeys.containsKey(plugin.getBasePlugin())) {
// this plugin extends a plugin that is not installed
LOG.warn("Plugin {} [{}] is ignored because its base plugin [{}] is not installed", plugin.getName(), plugin.getKey(), plugin.getBasePlugin());
removedKeys.add(plugin.getKey());
}
- if (!plugin.isCompatibleWith(server.getVersion())) {
- LOG.warn("Plugin {} [{}] is ignored because it requires at least SonarQube {}", plugin.getName(), plugin.getKey(), plugin.getMinimalSqVersion());
- removedKeys.add(plugin.getKey());
- }
-
for (PluginInfo.RequiredPlugin requiredPlugin : plugin.getRequiredPlugins()) {
PluginInfo available = pluginInfosByKeys.get(requiredPlugin.getKey());
if (available == null) {
}
@Test
- public void plugin_is_ignored_at_startup_if_unsupported_sq() throws Exception {
+ public void fail_if_plugin_does_not_support_sq_version() throws Exception {
when(server.getVersion()).thenReturn("1.0");
copyTestPluginTo("test-base-plugin", fs.getInstalledPluginsDir());
- underTest.start();
-
- // plugin requires SQ 4.5.1 but SQ 1.0 is installed
- assertThat(underTest.getPluginInfos()).isEmpty();
+ try {
+ underTest.start();
+ fail();
+ } catch (MessageException e) {
+ assertThat(e).hasMessage("Plugin Base Plugin [testbase] requires at least SonarQube 4.5.4");
+ }
}
@Test