mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
IDEA-99237 Property precedence is not the same when filtering resources with Maven or with IntelliJ
This commit is contained in:
@@ -217,7 +217,6 @@ public class MavenResourceCompiler implements ClassPostProcessingCompiler {
|
||||
|
||||
private static Properties loadPropertiesAndFilters(CompileContext context, MavenProject mavenProject) {
|
||||
Properties properties = new Properties();
|
||||
properties.putAll(mavenProject.getProperties());
|
||||
|
||||
for (String each : mavenProject.getFilters()) {
|
||||
try {
|
||||
@@ -234,6 +233,9 @@ public class MavenResourceCompiler implements ClassPostProcessingCompiler {
|
||||
context.addMessage(CompilerMessageCategory.WARNING, "Maven: Cannot read the filter. " + e.getMessage(), url, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
properties.putAll(mavenProject.getProperties());
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
@@ -1162,7 +1162,7 @@ public class MavenProjectsManager extends MavenSimpleProjectComponent
|
||||
|
||||
private static Properties getFilteringProperties(MavenProject mavenProject) {
|
||||
final Properties properties = new Properties();
|
||||
properties.putAll(mavenProject.getProperties());
|
||||
|
||||
for (String each : mavenProject.getFilters()) {
|
||||
try {
|
||||
FileInputStream in = new FileInputStream(each);
|
||||
@@ -1176,6 +1176,8 @@ public class MavenProjectsManager extends MavenSimpleProjectComponent
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
properties.putAll(mavenProject.getProperties());
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
@@ -923,6 +923,38 @@ public abstract class ResourceFilteringTest extends MavenImportingTestCase {
|
||||
"value2=value\n");
|
||||
}
|
||||
|
||||
public void testPropertyPriority() throws Exception {
|
||||
createProjectSubFile("filters/filter.properties", "xxx=fromFilterFile\n" +
|
||||
"yyy=fromFilterFile");
|
||||
createProjectSubFile("resources/file.properties","value1=${xxx}\n" +
|
||||
"value2=${yyy}");
|
||||
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<properties>" +
|
||||
" <xxx>fromProperties</xxx>" +
|
||||
"</properties>" +
|
||||
|
||||
"<build>" +
|
||||
" <filters>" +
|
||||
" <filter>filters/filter.properties</filter>" +
|
||||
" </filters>" +
|
||||
" <resources>" +
|
||||
" <resource>" +
|
||||
" <directory>resources</directory>" +
|
||||
" <filtering>true</filtering>" +
|
||||
" </resource>" +
|
||||
" </resources>" +
|
||||
"</build>");
|
||||
|
||||
compileModules("project");
|
||||
assertResult("target/classes/file.properties",
|
||||
"value1=fromProperties\n" +
|
||||
"value2=fromFilterFile");
|
||||
}
|
||||
|
||||
public void testCustomEscapingFiltering() throws Exception {
|
||||
createProjectSubFile("filters/filter.properties", "xxx=value");
|
||||
createProjectSubFile("resources/file.properties",
|
||||
|
||||
Reference in New Issue
Block a user