Add Maven Build Information to Properties File

This example shows you how to add your Maven Build Information like version number, build time, etc.. to a properties file. We use the resource filtering from the maven-resources-plugin. We get the information like version number from the maven pom.xml file. We assign the into a new property because there is a bug in maven which prevents from getting this property directly. Finally we use a custom date formatter to print out the required date format.

Add Maven Build Information To Properties File

We copy all the build information defined in our pom.xml file using the maven-resouces-plugin.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""

    <name>MAVEN - ${project.artifactId}</name>

        <>dd-MM-yyyy HH:mm




Properties File

Add the file to your classpath.


Build with maven

mvn clean package

Filtered Properties File

The generated/filtered properties file by Maven.

build.version=1.0.0-SNAPSHOT 14:11
build.url= - version-number-build-time-maven



You may also like...