Filtering in maven-war-plugin does not exclude directory

Leos Literak

This is a followup of my yesterday question Conditionally exclude some resources in maven from war. I was able to rearrange both development and production wars but filtering copies a directory properties to the war though it shall be excluded according to documentation. I could use packagingExcludes option, but I wonder why excludes does not work. Thank you for explanation.

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <classifier>dev</classifier>
        <webappDirectory>${project.build.directory}/${project.build.finalName}-dev</webappDirectory>
        <filters>
            <filter>${project.basedir}/configurations/properties/config_dev.prop</filter>
        </filters>
        <webResources>
            <resource>
                <directory>configurations</directory>
                <filtering>true</filtering>
                <targetPath>WEB-INF/classes</targetPath>
                <excludes>
                    <exclude>**/properties</exclude>
                </excludes>
            </resource>
        </webResources>
    </configuration>
    <executions>
        <execution>
            <id>package-prod</id>
            <phase>package</phase>
            <configuration>
                <classifier>prod</classifier>
                <webappDirectory>${project.build.directory}/${project.build.finalName}-prod</webappDirectory>
                <packagingExcludes>WEB-INF/classes/*.jks,WEB-INF/classes/acquirer.properties</packagingExcludes>
                <filters>
                    <filter>${project.basedir}/configurations/properties/config_prod.prop</filter>
                </filters>
                <webResources>
                    <resource>
                        <directory>configurations</directory>
                        <filtering>true</filtering>
                        <targetPath>WEB-INF/classes</targetPath>
                        <excludes>
                            <exclude>**/properties</exclude>
                        </excludes>
                    </resource>
                </webResources>
            </configuration>
            <goals>
                <goal>war</goal>
            </goals>
        </execution>
    </executions>
</plugin>
blackbuild

The exclusions for resources are on file base, i.e. they ignore folders. This is because of potential filtering done for webResources.

So, the globs in excludes are applied to all files in the directory, any file matching an exclude glob is excluded.

However, you only excluded a directory.

Change to **/properties/* or **/properties/** and it will work.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Filtering in maven-war-plugin does not exclude directory

From Dev

maven-war-plugin does not change .war default directory

From Dev

Maven war plugin not filtering as expected

From Dev

SpotBugs Maven Plugin exclude a directory

From Dev

maven-war-plugin not filtering on local

From Dev

Maven war plugin archiveClasses but exclude a package

From Dev

How to exclude certain resources from the maven war plugin war file?

From Dev

Apache Maven Resources Plugin exclude a directory

From Dev

Exclude file directory, by assembly plugin MAVEN

From Dev

Exclude contents of directory with maven rpm plugin

From Dev

maven war plugin put my resources in war root directory

From Dev

maven-war-plugin: exclude all directories but one

From Dev

how to override maven-war-plugin source directory

From Dev

maven exclude plugin in dependency

From Dev

Create war file with Windows batch and exclude specific directory without maven ant etc

From Dev

Maven - maven-war-plugin change destination directory (other than webapp)

From Dev

Ant exclude does not exclude directory

From Dev

Deploy war with Jetty maven plugin

From Dev

Is there a maven property for the exploded war directory?

From Dev

Exclude directory in uDeploy plugin for jenkins

From Dev

Maven - Exclude class files from war

From Dev

Conditionally exclude some resources in maven from war

From Dev

Maven - Exclude class files from war

From Dev

maven - how to exclude an entire module on from war

From Dev

When does a Maven plugin uses the POM in the current directory?

From Dev

Maven war plugin copy arbitrary files

From Dev

Use Maven Replacer Plugin Before WAR is Packaged

From Dev

maven-war-plugin and the Spring JavaConfig

From Dev

using maven-war-plugin with Spring BOM

Related Related

  1. 1

    Filtering in maven-war-plugin does not exclude directory

  2. 2

    maven-war-plugin does not change .war default directory

  3. 3

    Maven war plugin not filtering as expected

  4. 4

    SpotBugs Maven Plugin exclude a directory

  5. 5

    maven-war-plugin not filtering on local

  6. 6

    Maven war plugin archiveClasses but exclude a package

  7. 7

    How to exclude certain resources from the maven war plugin war file?

  8. 8

    Apache Maven Resources Plugin exclude a directory

  9. 9

    Exclude file directory, by assembly plugin MAVEN

  10. 10

    Exclude contents of directory with maven rpm plugin

  11. 11

    maven war plugin put my resources in war root directory

  12. 12

    maven-war-plugin: exclude all directories but one

  13. 13

    how to override maven-war-plugin source directory

  14. 14

    maven exclude plugin in dependency

  15. 15

    Create war file with Windows batch and exclude specific directory without maven ant etc

  16. 16

    Maven - maven-war-plugin change destination directory (other than webapp)

  17. 17

    Ant exclude does not exclude directory

  18. 18

    Deploy war with Jetty maven plugin

  19. 19

    Is there a maven property for the exploded war directory?

  20. 20

    Exclude directory in uDeploy plugin for jenkins

  21. 21

    Maven - Exclude class files from war

  22. 22

    Conditionally exclude some resources in maven from war

  23. 23

    Maven - Exclude class files from war

  24. 24

    maven - how to exclude an entire module on from war

  25. 25

    When does a Maven plugin uses the POM in the current directory?

  26. 26

    Maven war plugin copy arbitrary files

  27. 27

    Use Maven Replacer Plugin Before WAR is Packaged

  28. 28

    maven-war-plugin and the Spring JavaConfig

  29. 29

    using maven-war-plugin with Spring BOM

HotTag

Archive