private void activatePlugin(
      final PluginRepositoryArtifact plugin,
      final PluginManagerResponse response,
      final Set<GAVCoordinate> installedPluginsFilteredByGA)
      throws NoSuchPluginRepositoryArtifactException {
    final GAVCoordinate pluginGAV = plugin.getCoordinate();
    final PluginMetadata metadata = plugin.getPluginMetadata();

    final PluginDescriptor descriptor = new PluginDescriptor(pluginGAV);
    descriptor.setPluginMetadata(metadata);

    final PluginResponse result = new PluginResponse(pluginGAV, PluginActivationRequest.ACTIVATE);
    result.setPluginDescriptor(descriptor);

    activePlugins.put(pluginGAV, descriptor);

    final List<GAVCoordinate> importList = new ArrayList<GAVCoordinate>();
    final List<GAVCoordinate> resolvedList = new ArrayList<GAVCoordinate>();
    for (final PluginDependency pd : metadata.getPluginDependencies()) {
      // here, a plugin might express a need for GAV1, but GAV2 might be already activated
      // since today we just "play" dependency resolution, we support GA resolution only
      // so, we say "relax version matching" and rely on luck for now it will work
      final GAVCoordinate gav =
          new GAVCoordinate(pd.getGroupId(), pd.getArtifactId(), pd.getVersion());
      final PluginManagerResponse dependencyActivationResponse =
          activatePlugin(gav, false, installedPluginsFilteredByGA);
      response.addPluginManagerResponse(dependencyActivationResponse);
      importList.add(dependencyActivationResponse.getOriginator());
      resolvedList.add(dependencyActivationResponse.getOriginator());
    }
    descriptor.setImportedPlugins(importList);
    descriptor.setResolvedPlugins(resolvedList);

    if (!response.isSuccessful()) {
      result.setAchievedGoal(PluginActivationResult.BROKEN);
    } else {
      try {
        createPluginInjector(plugin, descriptor);
        result.setAchievedGoal(PluginActivationResult.ACTIVATED);
      } catch (final Throwable e) {
        result.setThrowable(e);
      }
    }

    reportActivationResult(response, result);
  }