mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-120881 maven - support of "nonFilteredFileExtensions" configuration in "maven-war-plugin"
This commit is contained in:
+21
-27
@@ -160,7 +160,7 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
addResources(resourceConfig.resources, mavenProject.getResources());
|
||||
addResources(resourceConfig.testResources, mavenProject.getTestResources());
|
||||
|
||||
addWebResources(module, projectConfig, mavenProject);
|
||||
addWebResources(resourceConfig, module, projectConfig, mavenProject);
|
||||
addEjbClientArtifactConfiguration(module, projectConfig, mavenProject);
|
||||
|
||||
resourceConfig.filteringExclusions.addAll(MavenProjectsTree.getFilterExclusions(mavenProject));
|
||||
@@ -334,7 +334,8 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addWebResources(@NotNull Module module, MavenProjectConfiguration projectCfg, MavenProject mavenProject) {
|
||||
private static void addWebResources(@NotNull MavenModuleResourceConfiguration resourceConfig, @NotNull Module module,
|
||||
MavenProjectConfiguration projectCfg, MavenProject mavenProject) {
|
||||
Element warCfg = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-war-plugin");
|
||||
if (warCfg == null) return;
|
||||
|
||||
@@ -355,6 +356,7 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
|
||||
addSplitAndTrimmed(artifactResourceCfg.packagingIncludes, warCfg.getChildTextTrim("packagingIncludes"));
|
||||
addSplitAndTrimmed(artifactResourceCfg.packagingExcludes, warCfg.getChildTextTrim("packagingExcludes"));
|
||||
addConfigValues(resourceConfig.filteringExclusions, "nonFilteredFileExtensions", "nonFilteredFileExtension", warCfg);
|
||||
|
||||
String warSourceDirectory = warCfg.getChildTextTrim("warSourceDirectory");
|
||||
if (warSourceDirectory == null) warSourceDirectory = "src/main/webapp";
|
||||
@@ -381,31 +383,8 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
|
||||
r.targetPath = resource.getChildTextTrim("targetPath");
|
||||
|
||||
Element includes = resource.getChild("includes");
|
||||
if (includes != null) {
|
||||
for (Element include : includes.getChildren("include")) {
|
||||
String includeText = include.getTextTrim();
|
||||
if (!includeText.isEmpty()) {
|
||||
r.includes.add(includeText);
|
||||
}
|
||||
}
|
||||
if (includes.getChildren("include").isEmpty()) {
|
||||
addSplitAndTrimmed(r.includes, includes.getTextTrim());
|
||||
}
|
||||
}
|
||||
|
||||
Element excludes = resource.getChild("excludes");
|
||||
if (excludes != null) {
|
||||
for (Element exclude : excludes.getChildren("exclude")) {
|
||||
String excludeText = exclude.getTextTrim();
|
||||
if (!excludeText.isEmpty()) {
|
||||
r.excludes.add(excludeText);
|
||||
}
|
||||
}
|
||||
if (excludes.getChildren("exclude").isEmpty()) {
|
||||
addSplitAndTrimmed(r.excludes, excludes.getTextTrim());
|
||||
}
|
||||
}
|
||||
addConfigValues(r.includes, "includes", "include", resource);
|
||||
addConfigValues(r.excludes, "excludes", "exclude", resource);
|
||||
|
||||
artifactResourceCfg.webResources.add(r);
|
||||
}
|
||||
@@ -421,6 +400,21 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addConfigValues(Collection<String> collection, String tag, String subTag, Element resource) {
|
||||
Element config = resource.getChild(tag);
|
||||
if (config != null) {
|
||||
for (Element value : config.getChildren(subTag)) {
|
||||
String text = value.getTextTrim();
|
||||
if (!text.isEmpty()) {
|
||||
collection.add(text);
|
||||
}
|
||||
}
|
||||
if (config.getChildren(subTag).isEmpty()) {
|
||||
addSplitAndTrimmed(collection, config.getTextTrim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addSplitAndTrimmed(Collection<String> collection, @Nullable String commaSeparatedList) {
|
||||
if (commaSeparatedList != null) {
|
||||
for (String s : StringUtil.split(commaSeparatedList, ",")) {
|
||||
|
||||
@@ -363,7 +363,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
|
||||
return ModuleRootManager.getInstance(getModule(module));
|
||||
}
|
||||
|
||||
protected void importProject(@NotNull @Language("xml") String xml) {
|
||||
protected void importProject(@NotNull @Language(value = "xml", prefix = "<project>", suffix = "</project>") String xml) {
|
||||
createProjectPom(xml);
|
||||
importProject();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user