Properties file priority : Resource File « Ant « Java Tutorial






<?xml version="1.0"?>
<project name="Apache Ant Properties Project" basedir=".">
  



  <property file="build.properties"/>
  <property file="build.properties.default"/>
  <property name="property.example" value="Global"/>

  <target name="print-global">
    <echo message="In print-global"/>
    <echo message="The value of property.example is: ${property.example}"/>
  </target>


  <target name="print-target" depends="print-global">
    <property name="property.example" value="Target"/>

    <echo message="In print-target"/>
    <echo message="The value of property.example is: ${property.example}"/>
  </target>
  

  <target name="print-file" depends="print-target">
    <property name="property.file.example" value="build.xml"/>

    <echo message="In print-file"/>
    <echo>
      The value of property.file.example is: ${property.file.example}
    </echo>
  </target>  
</project>





File: build.properties

property.example=Local File
property.file.example=build.properties


File: build.properties.default

property.example=Default File
property.file.example=build.properties.default








38.4.Resource File
38.4.1.Resource file base properties
38.4.2.URL based properties file
38.4.3.Properties file priority