Search code examples
mavenmaven-war-plugin

What is the difference between `warSourceExcludes` and `packagingExcludes` in Maven


The Maven WAR plugin has two configuration options: warSourceExcludes and packagingExcludes. There is some documentation on packagingExcludes, saying that:

It is possible to include or exclude certain files from the WAR file, by using the <packagingIncludes> and <packagingExcludes> configuration parameters.

However, I find it very difficult to find information on warSourceExcludes.

What is the difference between these two configuration options?

I'm using Maven 3.1.1 and the WAR plugin is version 2.4


Solution

  • warSourceExcludes: The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.


    packagingExcludes: The comma separated list of tokens to exclude from the WAR before packaging.

    With packagingExcludes, the tokens are completely excluded from the final war file.

    With warSourceExcludes, the tokens are just ignored when copying the war directory into the war file.

    As a result, if the tokens are present in the webappDirectory for example, they will not be ignored when using warSourceExcludes but will be when usingpackagingExcludes.