ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jordan R. Thompson" <Jor...@ThompCo.com>
Subject can't get "antfile" to work with other build.xml
Date Mon, 23 Sep 2002 20:56:00 GMT
Hi all,
I have a project called project2 that is in a jar file.  It needs the jar
file appUtils.jar in ../appUtils.  If I go to ../appUtils and build it with
"ant dist" it works fine.  I would like to be able to build both jar files
from the one build (project2).

Thanks in advance,
Jordan

Here is "parent" build.xml file (the one being called from it is below):
***************************************************************
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE project [
]>

<project name="tempProject" default="run" basedir=".">
  <description> build file for tempProject</description>

  <!-- set global properties for this build -->
  <property name="target_dir"   location="C:\temp\project2"/>
  <property name="src_home"     location="C:\Documents and Settings\Jordan
Thompson\My Documents\ThompCo\JavaClass\source"/>
  <property name="src_rel_path" value="edu/bcc/ajp/project2"/>
  <property name="src"          location="${src_home}/${src_rel_path}"/>
  <property name="appUtils"     location="../appUtils"/>
  <property name="build"        location="${target_dir}/build"/>
  <property name="dist"         location="${target_dir}/dist"/>
  <property name="docs"         location="${target_dir}/docs"/>
  <property name="class_path"   value="${build}"/>
  <property name="target_jar"   value="project2.jar"/>
  <property name="source_files" value="${src}/*.java"/>

  <target name="run" depends="dist" description="run the application" >
    <java fork="true" jar="${dist}/${target_jar}/"/>
  </target>

<!--  includes="edu/bcc/ajp/project2/**" -->
  <target name="dist" depends="compile" description="generate the
distribution" >
    <!-- Build the jar file -->
    <jar jarfile="${dist}/${target_jar}"
  includes="edu/bcc/ajp/project2/**"
  basedir="${build}"
  manifest="${src}/manifest.txt"/>
  </target>

  <target name="compile" depends="init,lib" description="compile the
source">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac classpath="${class_path}" srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="init" description="create the directories.">
    <!-- Create all of the directories -->
    <mkdir dir="${build}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${docs}"/>
  </target>

  <target name="lib">
    <!-- Create the appUtils class. -->
    <ant
  dir="..\appUtils"
  antfile="..\appUtils\build.xml"
  target="dist"/>
  </target>

  <target name="docs" depends="compile" description="generate the
documentation">
    <!-- Create the documentation -->
    <javadoc author="Jordan Thompson"
      destdir="${docs}"
      DocTitle="Advanced Java - Project 1"
      Author="Jordan Thompson"
      sourcepath="${src}"
      classpath="${build}"
      sourcefiles="${source_files}"/>
  </target>

  <target name="clean" description="clean up">
    <!-- Delete the ${dist} directory trees -->
    <delete dir="${build}"/>
  </target>

  <target name="sanitize" description="clean up everything" depends="clean">
    <!-- Delete the build, dist, and docs directory trees -->
    <delete dir="${dist}"/>
    <delete dir="${docs}"/>
  </target>
</project>

and here is the build.xml file that *should* be called:
***************************************************************
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE project [
]>

<project name="tempProject" default="dist" basedir=".">
  <description> build file for tempProject</description>

  <!-- set global properties for this build -->
  <property name="target_dir"   location="C:\temp\project2"/>
  <property name="src_home"     location="C:\Documents and Settings\Jordan
Thompson\My Documents\ThompCo\JavaClass\source"/>
  <property name="src_rel_path" value="edu/bcc/ajp/appUtils"/>
  <property name="src"          location="${src_home}/${src_rel_path}"/>
  <property name="build"        location="${target_dir}/build"/>
  <property name="dist"         location="${target_dir}/dist"/>
  <property name="docs"         location="${target_dir}/docs"/>
  <property name="target_jar"   value="appUtils.jar"/>
  <property name="source_files" value="EmailAddress.java,Dumper.java"/>

  <target name="run" depends="dist" description="run the application" >
    <java fork="true" jar="${dist}/${target_jar}/"/>
  </target>

  <target name="dist" depends="compile" description="generate the
distribution" >
    <!-- Build the jar file -->
    <jar jarfile="${dist}/${target_jar}"
  includes="edu/bcc/ajp/appUtils/**"
  basedir="${build}"
   manifest="${src}/manifest.txt"/>
  </target>

  <target name="compile" depends="init" description="compile the source" >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="init" description="create the directories." >
    <!-- Create all of the directories -->
    <mkdir dir="${build}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${docs}"/>
  </target>

  <target name="docs" depends="compile" description="generate the
documentation">
    <!-- Create the documentation -->
    <javadoc author="Jordan Thompson"
      destdir="${docs}"
      DocTitle="Advanced Java - Project 2"
      Author="Jordan Thompson"
      classpath="${build}"
      sourcefiles="${source_files}"/>
  </target>

  <target name="clean" description="clean up">
    <!-- Delete the ${dist} directory trees -->
    <delete dir="${build}"/>
  </target>

  <target name="sanitize" description="clean up everything" depends="clean">
    <!-- Delete the build, dist, and docs directory trees -->
    <delete dir="${dist}"/>
    <delete dir="${docs}"/>
  </target>
</project>




--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message