@Override
  protected void customizeComponents(@Nullable MavenWorkspaceMap workspaceMap) {
    super.customizeComponents(workspaceMap);

    ArtifactResolver customResolver = createCustomArtifactResolver(workspaceMap);
    if (customResolver != null) {

      addComponent(customResolver, ArtifactResolver.class);

      ArtifactDescriptorReader artifactDescriptorReader = getComponent(ArtifactDescriptorReader.class);
      if (artifactDescriptorReader instanceof DefaultArtifactDescriptorReader) {
        ((DefaultArtifactDescriptorReader)artifactDescriptorReader).setArtifactResolver(customResolver);
        artifactDescriptorReader = new CustomMaven36ArtifactDescriptorReader(artifactDescriptorReader);
        addComponent(artifactDescriptorReader, ArtifactDescriptorReader.class);
      }

      RepositorySystem repositorySystem = getComponent(RepositorySystem.class);
      if (repositorySystem instanceof DefaultRepositorySystem) {
        DefaultRepositorySystem defaultRepositorySystem = (DefaultRepositorySystem)repositorySystem;
        defaultRepositorySystem.setArtifactResolver(customResolver);

        defaultRepositorySystem.setArtifactDescriptorReader(artifactDescriptorReader);

        DependencyCollector dependencyCollector;
        if (VersionComparatorUtil.compare(getMavenVersion(), "3.9.0") >= 0) {
          // depth-first dependency collector, available since maven 3.9.0
          dependencyCollector = getComponentIfExists(DependencyCollector.class, "df");
        }
        else {
          // default dependency collector, maven 3.8
          dependencyCollector = getComponentIfExists(DependencyCollector.class);
        }
        try {
          Method method = dependencyCollector.getClass().getMethod("setArtifactDescriptorReader", ArtifactDescriptorReader.class);
          method.invoke(dependencyCollector, artifactDescriptorReader);
          defaultRepositorySystem.setDependencyCollector(dependencyCollector);
        }
        catch (Throwable e) {
          MavenServerGlobals.getLogger().warn(e);
        }
      }

      // TODO: redundant?
      ProjectDependenciesResolver projectDependenciesResolver = getComponent(ProjectDependenciesResolver.class);
      if (projectDependenciesResolver instanceof DefaultProjectDependenciesResolver) {
        try {
          DefaultProjectDependenciesResolver defaultResolver = (DefaultProjectDependenciesResolver)projectDependenciesResolver;
          Field repoSystemField = defaultResolver.getClass().getDeclaredField("repoSystem");
          repoSystemField.setAccessible(true);
          repoSystemField.set(defaultResolver, repositorySystem);
        }
        catch (Exception e) {
          MavenServerGlobals.getLogger().warn(e);
        }
      }

      // TODO: redundant?
      PluginDependenciesResolver pluginDependenciesResolver = getComponent(PluginDependenciesResolver.class);
      if (pluginDependenciesResolver instanceof DefaultPluginDependenciesResolver) {
        try {
          DefaultPluginDependenciesResolver defaultResolver = (DefaultPluginDependenciesResolver)pluginDependenciesResolver;
          Field repoSystemField = defaultResolver.getClass().getDeclaredField("repoSystem");
          repoSystemField.setAccessible(true);
          repoSystemField.set(defaultResolver, repositorySystem);
        }
        catch (Exception e) {
          MavenServerGlobals.getLogger().warn(e);
        }
      }
    }
  }
@Override
  protected void customizeComponents(@Nullable MavenWorkspaceMap workspaceMap)