Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven resource filtering exclude

Tags:

maven

I have a following maven configuration:

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>keystore.jks</exclude>
                </excludes>
            </resource>
        </resources>

I want keystore.jks to be included in my classes/war application but not to be processed by Maven filtering.

How to change this configuration ?

like image 423
alexanoid Avatar asked Jan 12 '16 17:01

alexanoid


People also ask

Which file extensions are excluded for resource filtering by default in Maven?

The plugin will prevent binary files filtering without adding some excludes configuration for the following file extensions jpg , jpeg , gif , bmp and png . If you like to add supplemental file extensions this can simply achieved by using a configuration like the following: <project>

What is Maven resource filtering?

Resource Filtering. You can use Maven to perform variable replacement on project resources. When resource filtering is activated, Maven will scan resources for property references surrounded by ${ and }.

What is Maven clean plugin?

The Maven Clean Plugin, as the name implies, attempts to clean the files and directories generated by Maven during its build. While there are plugins that generate additional files, the Clean Plugin assumes that these files are generated inside the target directory.

Which plugin is used to copy filter include and exclude non Java file into your final project?

Apache Maven Resources Plugin – Including and excluding files and directories.


1 Answers

According to the Maven Resource Filtering Documentation, this should work:

<resources>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <excludes>
            <exclude>keystore.jks</exclude>
        </excludes>
    </resource>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <includes>
            <include>keystore.jks</include>
        </includes>
    </resource>
</resources>
like image 59
Isabella Almeida Avatar answered Oct 01 '22 11:10

Isabella Almeida