import-bot (20212) [Avatar] Offline
#1
[Originally posted by amanand@lehman.com]

The properties never get picked up from windows.properties

Property ${host} has not been set
Property ${port} has not been set
Property ${j2ee.home} has not been set
Property ${tomcat.home} has not been set
Property ${jboss.deploy.dir} has not been set
I get these even before the osfamily task executes

<?xml version="1.0" encoding="UTF-8"?>
<project name="greeting" default="compile" basedir="../">
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="web.dir" value="web"/>

<property name="ant-contrib.jar" >
location="O:/Java/VendorLibs/ant-contrib-0.3/lib/ant-contrib-0.3.jar"/>

<taskdef resource="net/sf/antcontrib/antcontrib.properties">
classpath="${ant-contrib.jar}"/>

<target name="osfamily">
<osfamily property="os.family"/>
<echo message="${os.family}"></echo>
<property file="${os.family}.properties"></property>
</target>

<!--<property file="build.properties"/>-->
<property name="url.manager" value="http://${host}:${port}/manager"/>
<path id="project.classpath">
<pathelement location="${j2ee.home}/lib/j2ee.jar" />
<pathelement location="${tomcat.home}/server/lib/catalina-ant.jar"/>
</path>

<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>

<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>

<target name="compile" depends="prepare">
<!--Use <pathconvert> to convert path into a property-->
<pathconvert targetos="windows" property="windowsPath">
refid="project.classpath"/>
<echo>Windows path = ${windowsPath}</echo>

<javac destdir="${build.dir}" debug="true">
<src path="${src.dir}"/>
<classpath refid="project.classpath"/>
</javac>
</target>

<target name="war" depends="compile">
<war warfile="${dist.dir}/${webapp.context.name}.war">
webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}" includes="*.jsp"/>
<fileset dir="${web.dir}" includes="**/*.gif"/>
<classes dir="${build.dir}" includes="**/*.class"/>
<metainf dir="${web.dir}" includes="*.xml"/>
</war>
</target>
</project>
import-bot (20212) [Avatar] Offline
#2
Re: Problem using osfamily task
[Originally posted by erikhatcher]

The order of events in an Ant build file is to run *all* tasks not in a target
before executing the
desired target. This is why its best to put all non-target tasks at the top
of the build file for clarity.
Rearrange your build file so that all uses of the properties defined in
windows.properties are after
you load that file. Unfortunately with Ant 1.5.x this will require moving
<property> statements
into a target because of the restrictions of what cannot be outside of a target.