private static void addWebResources(RemotePathTransformerFactory.Transformer transformer,
                                      @NotNull Module module,
                                      MavenProjectConfiguration projectCfg,
                                      MavenProject mavenProject) {
    Element warCfg = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-war-plugin");
    if (warCfg == null) return;

    boolean filterWebXml = Boolean.parseBoolean(warCfg.getChildTextTrim("filteringDeploymentDescriptors"));
    Element webResources = warCfg.getChild("webResources");

    String webArtifactName = MavenUtil.getArtifactName("war", module, true);

    MavenWebArtifactConfiguration artifactResourceCfg = projectCfg.webArtifactConfigs.get(webArtifactName);
    if (artifactResourceCfg == null) {
      artifactResourceCfg = new MavenWebArtifactConfiguration();
      artifactResourceCfg.moduleName = module.getName();
      projectCfg.webArtifactConfigs.put(webArtifactName, artifactResourceCfg);
    }
    else {
      LOG.error("MavenWebArtifactConfiguration already exists.");
    }

    addSplitAndTrimmed(artifactResourceCfg.packagingIncludes, warCfg.getChildTextTrim("packagingIncludes"));
    addSplitAndTrimmed(artifactResourceCfg.packagingExcludes, warCfg.getChildTextTrim("packagingExcludes"));
    addConfigValues(artifactResourceCfg.nonFilteredFileExtensions, "nonFilteredFileExtensions", "nonFilteredFileExtension", warCfg);

    String warSourceDirectory = warCfg.getChildTextTrim("warSourceDirectory");
    if (warSourceDirectory == null) warSourceDirectory = "src/main/webapp";
    if (!FileUtil.isAbsolute(warSourceDirectory)) {
      warSourceDirectory = mavenProject.getDirectory() + '/' + warSourceDirectory;
    }
    artifactResourceCfg.warSourceDirectory =
      transformer.toRemotePathOrSelf(FileUtil.toSystemIndependentName(StringUtil.trimEnd(warSourceDirectory, '/')));

    addSplitAndTrimmed(artifactResourceCfg.warSourceIncludes, warCfg.getChildTextTrim("warSourceIncludes"));
    addSplitAndTrimmed(artifactResourceCfg.warSourceExcludes, warCfg.getChildTextTrim("warSourceExcludes"));

    if (webResources != null) {
      for (Element resource : webResources.getChildren("resource")) {
        ResourceRootConfiguration r = new ResourceRootConfiguration();
        String directory = resource.getChildTextTrim("directory");
        if (StringUtil.isEmptyOrSpaces(directory)) continue;

        if (!FileUtil.isAbsolute(directory)) {
          directory = mavenProject.getDirectory() + '/' + directory;
        }

        r.directory = transformer.toRemotePathOrSelf(directory);
        r.isFiltered = Boolean.parseBoolean(resource.getChildTextTrim("filtering"));

        r.targetPath = resource.getChildTextTrim("targetPath");

        addConfigValues(r.includes, "includes", "include", resource);
        addConfigValues(r.excludes, "excludes", "exclude", resource);

        artifactResourceCfg.webResources.add(r);
      }
    }

    if (filterWebXml) {
      ResourceRootConfiguration r = new ResourceRootConfiguration();
      r.directory = transformer.toRemotePathOrSelf(warSourceDirectory);
      r.includes = Collections.singleton("WEB-INF/web.xml");
      r.isFiltered = true;
      r.targetPath = "";
      artifactResourceCfg.webResources.add(r);
    }
  }
private static void addWebResources(RemotePathTransformerFactory.Transformer transformer,
                                      @NotNull Module module,
                                      MavenProjectConfiguration projectCfg,
                                      MavenProject mavenProject)