ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Observations from an ANT newbie
Date Wed, 20 Jun 2001 16:14:44 GMT
My comments are scattered about.  One problem you have is that you are 
using variable incorrectly.


-----Original Message-----
From: mwarman []
Sent: Wednesday, June 20, 2001 9:56 AM
To: ant-user
Cc: mwarman
Subject: RE: Observations from an ANT newbie

I create a test folder and put the following file in it. I also created 
build, src, init, dist,compile and clean folders under test.  I didn't 
see any source files, so I added some to src and build. I received this 
message from the build:
Target 'build' does not exist in this project. 
This is the build.xml file I used. 
<project name="MyProject" default="dist" basedir="."> 
  <!-- set global properties for this build --> 
  <property name="src" value="."/> 
  <property name="build" value="build"/> 
  <property name="dist"  value="dist"/> 
  <target name="init"> 
    <!-- Create the time stamp --> 
    <!-- Create the build directory structure used by compile --> 
    <mkdir dir="$build"/> 
    <!-- The above will create a directory called $build -->

    <mkdir dir="${build} />
    <!-- 1 -->
    <!-- the above will make a directory whose name is the value 
associated with the property build -->

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

    <!-- see #1 for proper use of variables -->
    <javac srcdir="${src}" destdir="${build}"/>

  <target name="dist" depends="compile"> 
    <!-- Create the distribution directory --> 
    <mkdir dir="$dist/lib"/> 

    <!-- ibid -->
    <mkdir dir="${dist}/lib"/> 

    <!-- Put everything in $build into the MyProject-$DSTAMP.jar file 
    <!-- ibid -->
    <jar jarfile="${dist}/lib/MyProject-$DSTAMP.jar" basedir="$build"/> 
  <target name="clean"> 
    <!-- Delete the $build and $dist directory trees --> 
    <!-- ibid -->
    <delete dir="${build}"/> 
    <!-- ibid -->
    <delete dir="${dist}"/> 

  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message