How can I allow an Ant property file to override the value set in another?

The initial problem with your set up is that you’ve got build.properties and build-defaults.properties reversed.

Ant Properties are set once and then can never be overridden. That’s why setting any property on the command line via a -Dproperty=value will always override anything you’ve set in the file; the property is set and then nothing can override it.

So the way you want this set up is:

<property file="build.properties" description="local build configuration overrides"/>
<property file="project.properties" description="Project configuration properties"/>
<property file="build-defaults.properties" description="default build configuration."/>

This way:

  1. Anything set at the command line takes precedence over build.properties
  2. Anything set in build.properties overrides other values
  3. etc. on down the line.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)