ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shoop, Michael R." <Michael.Sh...@jhuapl.edu>
Subject RE: Ant not accepting arguments
Date Fri, 08 Oct 2004 13:18:11 GMT
Thanks. Now maybe my head can heal from beating it against this problem.

Mike

-----Original Message-----
From: Dick, Brian E. [mailto:Brian.Dick@FMR.com] 
Sent: Friday, October 08, 2004 9:11 AM
To: Ant Users List
Subject: RE: Ant not accepting arguments


	<target name="test1" unless="${testType}">
...
	<target name="test2" if="${testType}">

Should be

	<target name="test1" unless="testType">
...
	<target name="test2" if="testType">

-----Original Message-----
From: Shoop, Michael R. [mailto:Michael.Shoop@jhuapl.edu] 
Sent: Friday, October 08, 2004 9:08 AM
To: 'user@ant.apache.org'
Subject: Ant not accepting arguments


Hi,

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>
	<target name="test2" if="${testType}">
		<echo message="Doing test2"/>
	</target>
	<target name="testing" depends="test1, test2"/>
</project>

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> 
    /build.xml
  Setting ro project property: ant.project.name -> TEST_PROJ
  Adding reference: TEST_PROJ
  Setting ro project property: ant.file.TEST_PROJ ->
C:\Temp\antbuild\build.xml
  Project base dir set to: C:\Temp\antbuild
    +Target:
   +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, ]

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

   testing:

BUILD SUCCESSFUL

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

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,

Mike


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


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


Mime
View raw message