skip to Main Content

I need to check if the properties file exists. If it not exists build.xml must use itself property.

  <property file="AntHW.properties"/> 
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist" location="dist"/>
  <property name="docdir" location="javadoc"/>

2

Answers


  1. You don’t need to check if it exists. Properties in ant are immutable, once set the values cannot be changed. So you want to import the properties file above your snippet, if the properties exist in that properties file the values are set and will not be overwritten by the snippet.

    Login or Signup to reply.
  2. Maybe you can try

    <available property="properties.available" file="path/to/properties/file" />
    

    Now properties.available will tell you whether or on the properties file exists.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search