ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shoop, Michael R." <>
Subject Ant not accepting arguments
Date Fri, 08 Oct 2004 13:07:36 GMT

I'm fairly new with ant and am having a problem with command line arguments.

For practice I have the following build.xml file:

<project name="TEST_PROJ" default="testing" basedir=".">
        <property name="test.dir" value="c:/temp"/>
	<target name="test1" unless="${testType}">
		<echo message="Doing test1"/>
	<target name="test2" if="${testType}">
		<echo message="Doing test2"/>
	<target name="testing" depends="test1, test2"/>

And I call it from the command line with
 ant -DtestType=true 

I should expect that target "test2" would execute and echo the "Doing test2"
message.  However, it executes target test1 and skips target test2.  I've
tried calling without the argument and still just target test1 executes.

I've tried running with the -debug option and the feedback from running:

   C:\Temp\antbuild>ant -DtestType=true -debug
  Apache Ant version 1.6.2 compiled on July 16 2004  
  Buildfile: build.xml
  Adding reference: ant.PropertyHelper
  Detected Java version: 1.4 in: c:\j2sdk1.4.2_04\jre
  Detected OS: Windows XP
  Adding reference: ant.ComponentHelper
  Setting ro project property: ant.version -> Apache Ant version 1.6.2
compiled on
    July 16 2004
  Setting ro project property: testType -> true
  Setting ro project property: ant.file -> C:\Temp\antbuild\build.xml
  Adding reference: ant.projectHelper
  Adding reference: ant.parsing.context
  Adding reference: ant.targets
    parsing buildfile C:\Temp\antbuild\build.xml with URI =
file:///C:/Temp/antbuild <file:///C:/Temp/antbuild> 
  Setting ro project property: -> TEST_PROJ
  Adding reference: TEST_PROJ
  Setting ro project property: ant.file.TEST_PROJ ->
  Project base dir set to: C:\Temp\antbuild
   +Target: test1
   +Target: test2
   +Target: testing
  Setting project property: test.dir -> c:/temp
  Build sequence for target `testing' is [test1, test2, testing]
  Complete build sequence is [test1, test2, testing, ]

       [echo] Doing test1
   Skipped because property 'true' not set.



I've also tried using a properties file  <ant -propertyfile
> and get similar results.  The properties file has one entry:

I've tried this both on a Windows platform (WinXP) and Unix Solaris machine
with the same versions of ant (1.6.x)

I'm baffled.

Thanks for any help,


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