Error loading property file Maven

淺唱寂寞╮ 提交于 2020-01-23 02:34:30

问题


i get this error from eclipse marker , when i try to load a filter file from pom.xml. it display the message below.

 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:

 <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 ?


回答1:


the solution is put ${basedir}/src/main/filters/filter.properties instead of 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>


来源:https://stackoverflow.com/questions/23477450/error-loading-property-file-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!