private static void addNonMavenResources(RemotePathTransformerFactory.Transformer transformer,
                                           @NotNull MavenProjectConfiguration projectCfg,
                                           @NotNull MavenProjectsManager mavenProjectsManager,
                                           @NotNull Project project) {
    Set<VirtualFile> processedRoots = new HashSet<>();

    for (MavenProject mavenProject : mavenProjectsManager.getProjects()) {
      for (String dir : ContainerUtil.concat(mavenProject.getSources(), mavenProject.getTestSources())) {
        VirtualFile file = LocalFileSystem.getInstance().findFileByPath(dir);
        if (file != null) {
          processedRoots.add(file);
        }
      }

      for (MavenResource resource : ContainerUtil.concat(mavenProject.getResources(), mavenProject.getTestResources())) {
        String directory = resource.getDirectory();
        ContainerUtil.addIfNotNull(processedRoots, LocalFileSystem.getInstance().findFileByPath(directory));
      }
    }

    CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(project);

    for (Module module : ModuleManager.getInstance(project).getModules()) {
      if (!mavenProjectsManager.isMavenizedModule(module)) continue;

      for (ContentEntry contentEntry : ModuleRootManager.getInstance(module).getContentEntries()) {
        for (SourceFolder folder : contentEntry.getSourceFolders()) {
          VirtualFile file = folder.getFile();
          if (file == null) continue;

          if (!compilerConfiguration.isExcludedFromCompilation(file) && !isUnderRoots(processedRoots, file)) {
            MavenModuleResourceConfiguration configuration = projectCfg.moduleConfigurations.get(module.getName());
            if (configuration == null) continue;

            List<ResourceRootConfiguration> resourcesList = folder.isTestSource() ? configuration.testResources : configuration.resources;

            final ResourceRootConfiguration cfg = new ResourceRootConfiguration();
            cfg.directory = transformer.toRemotePathOrSelf(FileUtil.toSystemIndependentName(file.getPath()));

            CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
            if (compilerModuleExtension == null) continue;


            String compilerOutputUrl = folder.isTestSource()
                                       ? compilerModuleExtension.getCompilerOutputUrlForTests()
                                       : compilerModuleExtension.getCompilerOutputUrl();

            cfg.targetPath = transformer.toRemotePathOrSelf(VfsUtilCore.urlToPath(compilerOutputUrl));

            convertIdeaExcludesToMavenExcludes(cfg, (CompilerConfigurationImpl)compilerConfiguration);

            resourcesList.add(cfg);
          }
        }
      }
    }
  }
private static void addNonMavenResources(RemotePathTransformerFactory.Transformer transformer,
                                           @NotNull MavenProjectConfiguration projectCfg,
                                           @NotNull MavenProjectsManager mavenProjectsManager,
                                           @NotNull Project project)