More Tutorials| Bioinformatics| Open Source| Photoshop| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Value in the properties file overwrite the value in the build.xml 
 

In this section, you will learn how to create a build.properties file.

 

Value in the properties file overwrite the value in the build.xml

                         

This example illustrates how to create a build.properties file in the C:\apache-tomcat-6.0.16\webapp\antBuild\build.properties and overwrite it's properties in the build.xml file. In this example, <property name="build.path"> is used to map the path of build.xml and build.properties file, <property url="http://localhost:8080/antBuild/build.properties"> is used to root url of properties file, <property file="build.properties" prefix="imported"> is used to define the property of the build.properties file and  <property environment="env"> is used to create an environment variable that is 'env'. Now the target <target name="built-in-properties"> is used to find base directory name, ant file name, version of ant, project name and version of java. The target <target name="build.path"> is used to print the file name and path of file and finally <target name="environment"> is used to print the processor architecture name and operating system name and print the ant home directory name.

Source code of build.xml:

<project name="Properties" basedir="." default="environment">

  <property name="build.path" value="${basedir}/build.xml:${basedir}/build.properties"/>
  <property url="http://localhost:8080/antBuild/build.properties"/>
  <property file="build.properties" prefix="imported"/>
  <property environment="env"/>
  
  <target name="built-in properties">
    <echo message="The base directory is: ${basedir}"/>      
    <echo message="The ant file is: ${ant.file}"/>
    <echo message="The Ant version is: ${ant.version}"/> 
    <echo message="The Project name is: ${ant.project.name}"/>     
    <echo message="The Java version is: ${ant.java.version}"/>     
  </target>

  <target name="build.path" depends="built-in properties">
    <echo message="The File name is: ${basedir}${file.separator}build.xml"/>
    <echo message="Path structure: ${basedir}${file.separator}build.xml${path.separator}
       ${basedir}${file.separator}build.properties"/>
  </target>

  <target name="environment" depends="build.path">
    <echo message="Built on: ${env.OS} ${env.PROCESSOR_ARCHITECTURE}"/>
    <echo message="ANT_HOME Directory name: ${env.ANT_HOME}"/>
  </target>

</project>

source code of build.properties:

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

Run this program on command prompt - the following output will be displayed.


Download Source Code

                         

» View all related tutorials
Related Tags: sql c database xml file url data ui build property user sed password word driver vi name using this element

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.