Reputation: 41
I have a problem with properties. here is content of my build.xml file:
<?xml version="1.0" ?>
<project name="default" default="package">
<target name="init">
<mkdir dir="build/classes" />
<mkdir dir="dist" />
</target>
<property file="${basedir}/localproperties"/>
<property name="javac.debug" value="off"/>
<target name="compile" depends="init" description="Compiles JAVA files">
<echo message="Debug: ${javac.debug}"/>
<javac srcdir="src"
destdir="build/classes"
classpathref="compile.classpath"
debug="${javac.debug}"/>
</target>
<path id="compile.classpath">
<fileset dir="lib" includes="*.jar"/>
</path>
</project>
and here is content of my localproperties file:
javac.debug = on
please note that I have saved localproperties as .xml file and put it into the same directory as build.xml
the problem is that it does not work as the output I get is: Debug: off
clearly it should be: Debug: on
please advise.
Upvotes: 1
Views: 25
Reputation: 72884
It should be:
<property file="${basedir}/localproperties.xml"/>
There is no extension assumed by the property
task. As long as the content follows the key-value convention, it can be any file extension. But it would be confusing to save as .xml
. Just save it as localproperties.properties
, or simply local.properties
.
Upvotes: 1