Search code examples
maven-2buildbuild-processjenkins

Optional filter file in Maven


I have the following filters configured in my pom.xml:

<build>
...
    <filters>
        <filter>build.properties</filter>
        <filter>user.properties</filter>
    </filters>
...
</build>

build.properties contains filters that are used for when the webapp is built for production. user.properties is where users override filters configured in build.properties for local deployment and testing (e.g. servername=localhost instead of servername=productionserver.com).

user.properties is not stored in source control, as it is local to each developer. When we build the webapp with Jenkins, it fails with "Error loading property file".

Is there any way to designate filters as optional, or tell Maven to ignore missing filters?


Solution

  • Have a look at setting up different maven build profiles for server builds and developer workstation builds