Java 加载属性文件 Maven 时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23477450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error loading property file Maven
提问by oussama.elhadri
i get this error from eclipse marker , when i try to load a filter file from pom.xml. it display the message below.
当我尝试从 pom.xml 加载过滤器文件时,我从 eclipse 标记收到此错误。它显示下面的消息。
Error loading property file 'src/main/filters/filter.properties' (org.apache.maven.plugins:maven-resources-plugin:2.6:resources:default-resources:process-resources)
pom.xml:
pom.xml:
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>src/main/filters/filter.properties</filter>
</filters>
</configuration>
</execution>
is that a bug ?
这是一个错误吗?
采纳答案by oussama.elhadri
the solution is put ${basedir}/src/main/filters/filter.properties
instead of src/main/filters/filter.properties
解决方案是放置${basedir}/src/main/filters/filter.properties
而不是src/main/filters/filter.properties
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>${basedir}/src/main/filters/filter.properties</filter>
</filters>
</configuration>
</execution>