Java/Ant/Property File
Define property file through url
<source lang="java">
<?xml version="1.0"?> <project name="Apache Ant Properties Project" default="properties.url" basedir=".">
<target name="properties.url"> <property url="http://localhost:8080/antBook/properties/build.properties"/> <path id="build.classpath.id"> <pathelement path="${build.classpath}"/> </path> <property name="build.classpath.property" refid="build.classpath.id"/> <echo message="Server URL: ${server.url}"/> <echo message="Build classpath: ${build.classpath}"/> <echo message="Build classpath converted: ${build.classpath.property}"/> </target>
</project>
</source>
Use separate property file
<source lang="java">
<?xml version="1.0"?> <project name="Apache Ant Properties Project" default="properties.localfile" basedir=".">
<target name="properties.localfile"> <property file="build.start.properties"/> <path id="build.classpath.id"> <pathelement path="${build.classpath}"/> </path> <property name="build.classpath.property" refid="build.classpath.id"/> <echo message="Server URL: ${server.url}"/> <echo message="Build classpath: ${build.classpath}"/> <echo message="Build classpath converted: ${build.classpath.property}"/> </target>
</project>
File: build.start.properties
server.name=localhost server.port=8080 server.scheme=http server.manager.name=manager server.url=${server.scheme}://${server.name}:${server.port}/${server.manager.name}/ j2ee.home=C:/j2ee catalina.home=C:/jakarta-tomcat j2ee.jar=${j2ee.home}/lib/j2ee.jar jsp.jar=${catalina.home}/common/lib/jsp-api.jar servlet.jar=${catalina.home}/common/lib/servlet-api.jar mysql.jar=${catalina.home}/common/lib/mysql.jar build.classpath=${mysql.jar};${j2ee.jar};${jsp.jar};${servlet.jar}
</source>