Pattern (MavenProject mavenProject) { Pattern res = mavenProject.getCachedValue(KEY); if (res == null) { Element cfg = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-resources-plugin"); if (cfg == null) { res = DEFAULT_DELIMITERS; } else { List<String> delimiters = MavenJDOMUtil.findChildrenValuesByPath(cfg, "delimiters", "delimiter"); if (delimiters.isEmpty() || delimiters.size() > 10) { res = DEFAULT_DELIMITERS; } else { StringBuilder patternBuilder = new StringBuilder(); for (String delimiter : delimiters) { delimiter = delimiter.trim(); if (delimiter.isEmpty()) continue; int ind = delimiter.indexOf('*'); if (ind >= 0) { appendDelimiter(patternBuilder, delimiter.substring(0, ind), delimiter.substring(ind + 1)); } else { appendDelimiter(patternBuilder, delimiter, delimiter); } } // <useDefaultDelimiters> is not used if custom delimiters are not present. boolean useDefaultDelimiters = true; String useDefaultDelimitersText = cfg.getChildText("useDefaultDelimiters"); if (StringUtil.isNotEmpty(useDefaultDelimitersText)) { useDefaultDelimiters = Boolean.parseBoolean(useDefaultDelimitersText); } if (useDefaultDelimiters) { appendDelimiter(patternBuilder, "${", "}"); appendDelimiter(patternBuilder, "@", "@"); } res = Pattern.compile(patternBuilder.toString()); } } res = mavenProject.putCachedValue(KEY, res); } return res; }