diff --git a/src/main/java/spoon/support/compiler/SpoonPom.java b/src/main/java/spoon/support/compiler/SpoonPom.java index 4d8d7c4a9a6..9cb7885bb73 100644 --- a/src/main/java/spoon/support/compiler/SpoonPom.java +++ b/src/main/java/spoon/support/compiler/SpoonPom.java @@ -310,7 +310,7 @@ public List getClasspathTmpFiles(String fileName) { } // Pattern corresponding to maven properties ${propertyName} - private static Pattern mavenProperty = Pattern.compile("\\$\\{.*\\}"); + private static final Pattern MAVEN_PROPERTY = Pattern.compile("\\$\\{.*?}"); /** * Extract the variable from a string @@ -318,7 +318,7 @@ public List getClasspathTmpFiles(String fileName) { private String extractVariable(String value) { String val = value; if (value != null && value.contains("$")) { - Matcher matcher = mavenProperty.matcher(value); + Matcher matcher = MAVEN_PROPERTY.matcher(value); while (matcher.find()) { String var = matcher.group(); val = val.replace(var, getProperty(var.substring(2, var.length() - 1))); @@ -353,6 +353,8 @@ private String getProperty(String key) { } } else if ("project.basedir".equals(key) || "pom.basedir".equals(key) || "basedir".equals(key)) { return pomFile.getParent(); + } else if ("file.separator".equals(key)) { + return File.separator; } String value = extractVariable(model.getProperties().getProperty(key)); if (value == null) {