FileCopyingHandler (@NotNull JpsArtifact artifact, @NotNull File root, @NotNull File targetDirectory, @NotNull JpsPackagingElement contextElement, @NotNull JpsModel model, @NotNull BuildDataPaths buildDataPaths) { MavenProjectConfiguration projectConfiguration = JpsMavenExtensionService.getInstance().getMavenProjectConfiguration(buildDataPaths); if (projectConfiguration == null) return null; MavenWebArtifactConfiguration artifactResourceConfiguration = projectConfiguration.webArtifactConfigs.get(artifact.getName()); if (artifactResourceConfiguration == null) return null; MavenModuleResourceConfiguration moduleResourceConfiguration = projectConfiguration.moduleConfigurations.get(artifactResourceConfiguration.moduleName); if (moduleResourceConfiguration == null) { LOG.debug("Maven resource configuration not found for module " + artifactResourceConfiguration.moduleName); return null; } if (contextElement instanceof JpsModuleOutputPackagingElement) { if (!FileUtil.namesEqual("classes", root.getName())) return null; return new MavenClassesCopyingHandler(root.getParentFile(), artifactResourceConfiguration, moduleResourceConfiguration); } ResourceRootConfiguration rootConfiguration = artifactResourceConfiguration.getRootConfiguration(root); String relativeDirInWar = null; if (rootConfiguration == null) { if (artifact.getOutputPath() != null && !FileUtil.isAncestor(new File(artifactResourceConfiguration.warSourceDirectory), root, false)) { relativeDirInWar = FileUtil.getRelativePath(new File(artifact.getOutputPath()), targetDirectory); if (relativeDirInWar == null) return null; } ResourceRootConfiguration warRootConfig = getWarRootConfig(artifactResourceConfiguration, moduleResourceConfiguration); if (root.isFile()) { root = root.getParentFile(); } warRootConfig.directory = root.getPath(); if (relativeDirInWar == null) { warRootConfig.includes.addAll(artifactResourceConfiguration.warSourceIncludes); warRootConfig.excludes.addAll(artifactResourceConfiguration.warSourceExcludes); } return new MavenWebArtifactCopyingHandler(warRootConfig, moduleResourceConfiguration, relativeDirInWar); } MavenResourceFileProcessor fileProcessor = new MavenResourceFileProcessor(projectConfiguration, model.getProject(), moduleResourceConfiguration); return new MavenWebRootCopyingHandler(fileProcessor, artifactResourceConfiguration, rootConfiguration, moduleResourceConfiguration, root); }