Maven Resources Plugin and Binary Fonts

Copy WAR resources without corrupt binary files

The Maven Resources Plugin copies project resources into the output dir during the creation of the WAR. During this phase the plugin performs the filtering operation, where the variables in the resource files are replaced with the specified values. But this filtering operation does not have to be done for binary files, to prevent these files from being corrupted. For example binary files that can be corrupted by the filtering phase of the Maven Resources Plugin are the fonts.

If there are any corrupted fonts in the deployed WAR, just check with the developer’s tools that each browser provides, if there are any errors in the font decoding phase of the browser itself. For example, as in this case:

fonts_corruptedmessages such as “Failed to decode downloaded font”, or “OTS parsing error: Failed to convert WOFF 2 font to SFNT”, or “incorrect file size in WOFF header”, or “GDEF: invalid table offset” are all signs that binary fonts are corrupt.

To avoid these problems just add the exclusions in the configuration section of the plugin in the pom.xml file. For example:


in this case all files with extensions declared in nonFilteredFileExtensions will only be copied to the output dir without being filtered.


2 thoughts on “Maven Resources Plugin and Binary Fonts”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: