ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murray, Mike" <...@ptc.com>
Subject RE: InheritAll=false Leaves Java System Properties Undefined
Date Wed, 06 Aug 2003 23:10:50 GMT
I've identified the interaction responsible for the problem, although I don't understand exactly
what Ant is doing with properties to know exactly what the problem is.  With that limited
knowledge, it does appear that Ant is mishandling them somehow.  

The interaction is that I am defining a custom task, which does a System.setProperties() as
part of its static initialization.  As the output below shows, file.separator is still available
via System.getProperty() after the antcall, but it is no longer available via ${file.separator}.
 Yet, the properties that I added to System properties are then available via Ant property
access. 

If anyone knowledgeable about this area has any comment, it would be greatly appreciated.

Thanks, Mike

With this project: 

<?xml version="1.0"?>

<!DOCTYPE project [
   <!ENTITY cus_task         SYSTEM "file:cusTask.ae_xml">
]>

<project default="test_call">
   
   &cus_task;                        <!-- import all of common stuff -->

   <target name="test_call">
      <echo>ant.home is ${ant.home}</echo>
      <echo>wt.tools.DEBUG is ${wt.tools.DEBUG}</echo>
      <echo>file.separator is ${file.separator}</echo>
      
      <antcall target="test_callee" inheritAll="false"/>
   </target>
   
   <target name="test_callee">
      <echo>ant.home is ${ant.home}</echo>
      <echo>wt.tools.DEBUG is ${wt.tools.DEBUG}</echo>
      <echo>file.separator is ${file.separator}</echo>
   </target>

</project>

I get this:

L:\wcL10N>ant -f prop_test.xml test_call
Buildfile: prop_test.xml

   System.getProperty( "file.separator" ) = \
   System.getProperty( "wt.tools.DEBUG" ) = null
    --- Loading wt properties with System.setProperties() ---
   System.getProperty( "file.separator" ) = \
   System.getProperty( "wt.tools.DEBUG" ) = true

test_call:
     [echo] ant.home is L:\tools_vs\ant\bin\..
     [echo] wt.tools.DEBUG is ${wt.tools.DEBUG}
     [echo] file.separator is \

   System.getProperty( "file.separator" ) = \
   System.getProperty( "wt.tools.DEBUG" ) = true
    --- Loading wt properties with System.setProperties() ---
   System.getProperty( "file.separator" ) = \
   System.getProperty( "wt.tools.DEBUG" ) = true

test_callee:
     [echo] ant.home is ${ant.home}
     [echo] wt.tools.DEBUG is true
     [echo] file.separator is ${file.separator}

-----Original Message-----
From: Murray, Mike B. 
Sent: Friday, July 11, 2003 9:34 AM
To: Ant Users List
Subject: RE: InheritAll=false Leaves Java System Properties Undefined


You are correct.  I even modified your test to more closely mimic what I am doing and I can't
get it to "fail".  Yet, when I run my real targets, verbose output gives me:
	Property ${file.separator} has not been set
	Setting project property: file.sep -> \${file.separator}

I am able to work around this problem by passing it as a param:
	 <param name="file.separator" value="${file.separator}"/>

Apparently, I'm missing some other unique aspect of my true scenario.  I'll have to revisit
it later.

Thanks for looking into it.

-----Original Message-----
From: peter reilly [mailto:peter.reilly@corvil.com]
Sent: Friday, July 11, 2003 7:08 AM
To: Ant Users List
Subject: Re: InheritAll=false Leaves Java System Properties Undefined


I do not see this problem,
using a build script:

<project default="call">
  <target name="call">
    <antcall target="callee" InheritAll="false"/>
  </target>

  <target name="callee">
    <echo>ant.home is ${ant.home}</echo>
  </target>
</project>

The result is:

Buildfile: build.xml

call:

callee:
     [echo] ant.home is /home/preilly/apps/apache-ant-1.5.3-1


Peter

On Thu, 2003-07-10 at 04:39, Murray, Mike B. wrote:
> When using InheritAll=false for Ant and AntCall tasks, this seems to leave the "built-in"
system properties from Java undefined.  Is there anyway to cause these to be initialized,
or do I have to resort to passing each required system property down from the calling build
script?
>  
> http://ant.apache.org/manual/using.html#built-in-props
>  <http://ant.apache.org/manual/using.html#built-in-props>  
> Thanks, Mike

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


Mime
View raw message