Maven Resources Filtering

There are times when we want to use some parameters that can be only specified during compile time. A fine way of implementing this is via Maven’s resources tag and the place is in the POM:

<project xmlns="" xmlns:xsi=""







notice in particular the resources tag:


The default filtering value for this directory is false so we need to override it switching filtering to true. This basically will scan the directory and search for ${} entries referring to POM properties or entries. All this is happening during compile time.

Say for instance we have a in /src/main/resources with the following entry:


then after compilation in the produced jar we will find:


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s