Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter specific file with maven resource filtering

My spring+maven project has .properties and .xml resource files. I want to set up filtering for .properties only excluding all spring xml configs. This is pretty straightforward thing:

    <resource>
        <filtering>true</filtering>
        <directory>${basedir}/src/main/resources</directory>
        <excludes>
            <exclude>**/*.properties</exclude>
        </excludes>
    </resource>
    <resource>
        <filtering>false</filtering>
        <directory>${basedir}/src/main/resources</directory>
        <includes>
            <include>**/*.xml</include>
        </includes>
    </resource>

But now I want to apply filter to one concrete xml file, say env-config.xml. So the problem is how to apply filters to all .properties files and only one specific xml file?

like image 720
Vladimir Avatar asked Jan 03 '13 22:01

Vladimir


1 Answers

Try to add one more resource element

<resource>
    <filtering>true</filtering>
    <directory>${basedir}/src/main/resources</directory>
    <includes>
        <include>path/to/file.xml</include>
    </includes>
</resource>

Not sure if it works, I don't have maven right now.

like image 167
Stefanos Kalantzis Avatar answered Nov 04 '22 16:11

Stefanos Kalantzis