You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Chris Green <ch...@googlemail.com> on 2008/05/28 09:37:03 UTC

Calling a cmd batch file from Ant

I am calling a dos batch file from an Ant script using the following code :-

<property name="dos" location="c:/windows/system32/cmd.exe"/>


<exec executable="${dos}" dir="c:/build/">
          <arg value="CommonCommponent.bat"/>
</exec>

On the assumption that I get the Microsoft Windows Copyright info appear, I
assume the above commands are running ok. The only trouble is, the contents
/ commands in the batch file don't seen to get executed.

Batch file contents are :-

set component=common
ant -f %build.dir%/component.xml

Any help would be gratefully received.

Chris

AW: Calling a cmd batch file from Ant

Posted by Ja...@rzf.fin-nrw.de.
<ant> with nested <property> ?
Or use of <macrodef>s?

Jan 


________________________________

	The reason I'm not using ant is that :-
	 
	1. My main build.xml script calls the component.xml script
numerous times.
	2. Each time the component.xml script is called, the variable
'component' needs to be set to something different.
	3. Component.xml is generic therefore don't want to hard code
anything variables in
	4. Once variable set, can't be changed.
	 
	Honestly, there is some underlying logic behind all of this.
	 
	Chris
	
	
	On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de>
wrote:
	

		> I am calling a dos batch file from an Ant script using
the
		> following code :-
		>
		> <property name="dos"
location="c:/windows/system32/cmd.exe"/>
		>
		>
		> <exec executable="${dos}" dir="c:/build/">
		>           <arg value="CommonCommponent.bat"/>
		> </exec>
		>
		> On the assumption that I get the Microsoft Windows
Copyright
		> info appear, I
		> assume the above commands are running ok. The only
trouble
		> is, the contents
		> / commands in the batch file don't seen to get
executed.
		
		
		
		http://ant.apache.org/faq.html#batch-shell-execute
		


		> Batch file contents are :-
		>
		> set component=common
		> ant -f %build.dir%/component.xml
		
		
		Why not use <ant> ?
		
		
		Jan
		
	
---------------------------------------------------------------------
		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


Re: Calling a cmd batch file from Ant

Posted by Olivier Gies <ol...@bull.net>.
Hi,

Values of Ant properties set in <ant> or <antcall> are NOT kept between 
different calls to <ant> or <antcall>.

Note in particular that, for this reason, ant-contrib proivdes a 
<runtarget> (a bit shaky, though) which WILL keep the values of 
properties set in the called target, contrarily to <ant> or <antcall>.

That said, I would add that you should definitely spend time having 
<var> / ant-contrib work fine rather than construct complex Ant / shell 
interactions, which completely break the advantage of being 
system-independent.

About the ant-contrib task defintion: I have been using this line for 
importing ant-contrib tasks in a pretty big Ant-based tool (multiple 
J2EE app installer), and it works just fine:
        <typedef resource="net/sf/antcontrib/antlib.xml" />

Like said earlier, the ant-contrib.jar should be in the Ant's runtime 
classpaht. I.e., in $ANT_HOME/lib, or explicitely on the command line 
when running Ant.
Note that extracting the antlib.xml file from the JAR achieves nothing, 
as "classpath" is definitely different from "file path".



*Olivier Gies*

*Delivery Manager
Customs & Tax Software Engineering Center
Bull, Architect of an Open World ^TM
Phone: +86 (10) 65978001 - Ext 555 *

*www.bull.com <http://www.bull.com/>*

*This e-mail contains material that is confidential for the sole use of 
the intended recipient. Any review, reliance or distribution by others 
or forwarding without express permission is strictly prohibited. If you 
are not the intended recipient, please contact the sender and delete all 
copies.*



-------- Original Message  --------
Subject: Re: Calling a cmd batch file from Ant
From: Chris Green <ch...@googlemail.com>
To: Ant Users List <us...@ant.apache.org>
Date: 28/05/2008 16:57
> Jan
>
> Unless I'm missing something here, that wouldn't work.
>
> You can't redefine an ant property one it has already been defined in one
> specific execution of the said script.
>
> That's why I was trying to get the batch file to set up an environment
> variable before executing the generic component.xml
>
> Chris
>
> On Wed, May 28, 2008 at 10:49 AM, <Ja...@rzf.fin-nrw.de> wrote:
>
>   
>> But in your original post you have specified the component in your batch
>> file.
>>     
>>>>>> Batch file contents are :-
>>>>>>
>>>>>> set component=common
>>>>>> ant -f %build.dir%/component.xml
>>>>>>             
>> Where is the difference?
>>
>> <project name="master">
>>    <target name="buildComponentOne">
>>        <ant antfile="component.xml">
>>            <property name="component" value="one"/>
>>        </ant>
>>    </target>
>>    <target name="buildComponentTwo">
>>        <ant antfile="component.xml">
>>            <property name="component" value="two"/>
>>        </ant>
>>    </target>
>> </project>
>>
>> <project name="component">
>>    <property file="${component}.properties"/>
>>    <echo> Build one: ${one} </echo>
>>    <echo> Build two: ${two} </echo>
>> </project>
>>
>> one.properties:
>> # Specifies which parts for component 'one' to do
>> one=J
>> two=N
>>
>> two.properties:
>> # Specifies which parts for component 'one' to do
>> one=J
>> two=J
>>
>>
>>
>> Jan
>>
>>
>>
>>     
>>> -----Ursprüngliche Nachricht-----
>>> Von: Chris Green [mailto:chris.green100@googlemail.com]
>>> Gesendet: Mittwoch, 28. Mai 2008 10:36
>>> An: Ant Users List
>>>       
>>  > Betreff: Re: Calling a cmd batch file from Ant
>>     
>>> Can't use ant or antcall's even in a nested structure. Reason being :-
>>>
>>> Script process designed to build numerous components of an
>>> application.
>>>
>>> Each of these components has a parameter set up in the
>>> properties file set
>>> to Y or N to define whether that component is built during
>>> that execution of
>>> the script.
>>>
>>> Therefore, more than one component may need to be built
>>> during one execution
>>> of the build script.
>>>
>>> On this basis, the controlling ant script, build.xml cannot have the
>>> component variable defined within it, even nested, as it
>>> potentially needs
>>> to be redefined multiple times.
>>>
>>> The component.xml file (generic) which is called again and
>>> again for each
>>> component that needs to be build. Want to keep this generic
>>> and as simple as
>>> possible. Therefore no hard coding using if statements to set the
>>> 'component' variable.
>>>
>>> On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen <
>>> Juergen.Knuplesch@icongmbh.de> wrote:
>>>
>>>       
>>>> If you use <ant> Task or <antcall>  you can run the target
>>>>         
>>> with different
>>>       
>>>> content of a property.
>>>> E.g.
>>>>
>>>> <antcall target="your.target" inheritall="false">
>>>>                  <param name="your.property" value="value1" />
>>>>                </antcall>
>>>>
>>>> <antcall target="your.target" inheritall="false">
>>>>                  <param name="your.property" value="value2" />
>>>>                </antcall>
>>>>
>>>> I even use this in <for> loops made with antcontrb.
>>>>
>>>>
>>>>
>>>> --
>>>> Jürgen Knuplesch                    www.icongmbh.de
>>>> icon Systemhaus GmbH                Tel. +49 711 806098-275
>>>> Sophienstraße 40
>>>> D-70178 Stuttgart                   Fax. +49 711 806098-299
>>>>
>>>> Geschäftsführer: Uwe Seltmann
>>>> HRB Stuttgart 17655
>>>> USt-IdNr.: DE 811944121
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Chris Green [mailto:chris.green100@googlemail.com]
>>>> Gesendet: Mittwoch, 28. Mai 2008 09:51
>>>> An: Ant Users List
>>>> Cc: Jan.Materne@rzf.fin-nrw.de
>>>> Betreff: Re: Calling a cmd batch file from Ant
>>>>
>>>> The reason I'm not using ant is that :-
>>>>
>>>> 1. My main build.xml script calls the component.xml script
>>>>         
>>> numerous times.
>>>       
>>>> 2. Each time the component.xml script is called, the
>>>>         
>>> variable 'component'
>>>       
>>>> needs to be set to something different.
>>>> 3. Component.xml is generic therefore don't want to hard
>>>>         
>>> code anything
>>>       
>>>> variables in 4. Once variable set, can't be changed.
>>>>
>>>> Honestly, there is some underlying logic behind all of this.
>>>>
>>>> Chris
>>>>
>>>> On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
>>>>
>>>>         
>>>>>> I am calling a dos batch file from an Ant script using
>>>>>>             
>>> the following
>>>       
>>>>>> code :-
>>>>>>
>>>>>> <property name="dos" location="c:/windows/system32/cmd.exe"/>
>>>>>>
>>>>>>
>>>>>> <exec executable="${dos}" dir="c:/build/">
>>>>>>           <arg value="CommonCommponent.bat"/> </exec>
>>>>>>
>>>>>> On the assumption that I get the Microsoft Windows
>>>>>>             
>>> Copyright info
>>>       
>>>>>> appear, I assume the above commands are running ok. The
>>>>>>             
>>> only trouble
>>>       
>>>>>> is, the contents / commands in the batch file don't seen to get
>>>>>> executed.
>>>>>>             
>>>>> http://ant.apache.org/faq.html#batch-shell-execute
>>>>>
>>>>>
>>>>>           
>>>>>> Batch file contents are :-
>>>>>>
>>>>>> set component=common
>>>>>> ant -f %build.dir%/component.xml
>>>>>>             
>>>>> Why not use <ant> ?
>>>>>
>>>>>
>>>>> Jan
>>>>>
>>>>>
>>>>>           
>>> ---------------------------------------------------------------------
>>>       
>>>>> 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
>>>>
>>>>
>>>>         
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>     
>
>   


Re: Calling a cmd batch file from Ant

Posted by Peter Reilly <pe...@gmail.com>.
There can be issues with using <ant> and <antcall>

 - they are in the same VM
 - there can be "leakages" between projects.
 - the rules for basedir are a bit weird

I use the following (on linux):

  <macrodef name="sub">
    <attribute name="dir"/>
    <attribute name="target"/>
    <sequential>
      <exec executable="bash"
            dir="@{dir}"
            failonerror="yes">
        <arg value="-c"/>
        <arg value="ant -emacs @{target}"/>
      </exec>
    </sequential>
  </macrodef>

and:
  <macrodef name="dirs">
    <attribute name="target"/>
    <sequential>
      <ac:for param="dir" list="${dirs}">
        <sequential>
          <sub dir="@{dir}" target="@{target}"/>
        </sequential>
      </ac:for>
    </sequential>
  </macrodef>


- one can do something similar on dos (if one has the patience).


Peter


On Wed, May 28, 2008 at 10:03 AM, Knuplesch, Juergen
<Ju...@icongmbh.de> wrote:
> But if you use <ANT> or <ANTCALL> it is like you would start  ANT a second time. Therfore the properties
> are set in the target or script that you call. The old values are lost if you use the attribute
> Inheritall=false
> And using <property> inside <Ant> sets some properties to a value you define.
>
>
>
> --
> Jürgen Knuplesch
> -----Ursprüngliche Nachricht-----
> Von: Chris Green [mailto:chris.green100@googlemail.com]
> Gesendet: Mittwoch, 28. Mai 2008 10:56
> An: Ant Users List
> Betreff: Re: Calling a cmd batch file from Ant
>
> Jan
>
> Unless I'm missing something here, that wouldn't work.
>
> You can't redefine an ant property one it has already been defined in one specific execution of the said script.
>
> That's why I was trying to get the batch file to set up an environment variable before executing the generic component.xml
>
> Chris
>
> On Wed, May 28, 2008 at 10:49 AM, <Ja...@rzf.fin-nrw.de> wrote:
>
>> But in your original post you have specified the component in your
>> batch file.
>> > > > > Batch file contents are :-
>> > > > >
>> > > > > set component=common
>> > > > > ant -f %build.dir%/component.xml
>>
>> Where is the difference?
>>
>> <project name="master">
>>    <target name="buildComponentOne">
>>        <ant antfile="component.xml">
>>            <property name="component" value="one"/>
>>        </ant>
>>    </target>
>>    <target name="buildComponentTwo">
>>        <ant antfile="component.xml">
>>            <property name="component" value="two"/>
>>        </ant>
>>    </target>
>> </project>
>>
>> <project name="component">
>>    <property file="${component}.properties"/>
>>    <echo> Build one: ${one} </echo>
>>    <echo> Build two: ${two} </echo>
>> </project>
>>
>> one.properties:
>> # Specifies which parts for component 'one' to do one=J two=N
>>
>> two.properties:
>> # Specifies which parts for component 'one' to do one=J two=J
>>
>>
>>
>> Jan
>>
>>
>>
>> > -----Ursprüngliche Nachricht-----
>> > Von: Chris Green [mailto:chris.green100@googlemail.com]
>> > Gesendet: Mittwoch, 28. Mai 2008 10:36
>> > An: Ant Users List
>>  > Betreff: Re: Calling a cmd batch file from Ant
>> >
>> > Can't use ant or antcall's even in a nested structure. Reason being
>> > :-
>> >
>> > Script process designed to build numerous components of an
>> > application.
>> >
>> > Each of these components has a parameter set up in the properties
>> > file set to Y or N to define whether that component is built during
>> > that execution of the script.
>> >
>> > Therefore, more than one component may need to be built during one
>> > execution of the build script.
>> >
>> > On this basis, the controlling ant script, build.xml cannot have the
>> > component variable defined within it, even nested, as it potentially
>> > needs to be redefined multiple times.
>> >
>> > The component.xml file (generic) which is called again and again for
>> > each component that needs to be build. Want to keep this generic and
>> > as simple as possible. Therefore no hard coding using if statements
>> > to set the 'component' variable.
>> >
>> > On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen <
>> > Juergen.Knuplesch@icongmbh.de> wrote:
>> >
>> > > If you use <ant> Task or <antcall>  you can run the target
>> > with different
>> > > content of a property.
>> > > E.g.
>> > >
>> > > <antcall target="your.target" inheritall="false">
>> > >                  <param name="your.property" value="value1" />
>> > >                </antcall>
>> > >
>> > > <antcall target="your.target" inheritall="false">
>> > >                  <param name="your.property" value="value2" />
>> > >                </antcall>
>> > >
>> > > I even use this in <for> loops made with antcontrb.
>> > >
>> > >
>> > >
>> > > --
>> > > Jürgen Knuplesch                    www.icongmbh.de
>> > > icon Systemhaus GmbH                Tel. +49 711 806098-275
>> > > Sophienstraße 40
>> > > D-70178 Stuttgart                   Fax. +49 711 806098-299
>> > >
>> > > Geschäftsführer: Uwe Seltmann
>> > > HRB Stuttgart 17655
>> > > USt-IdNr.: DE 811944121
>> > > -----Ursprüngliche Nachricht-----
>> > > Von: Chris Green [mailto:chris.green100@googlemail.com]
>> > > Gesendet: Mittwoch, 28. Mai 2008 09:51
>> > > An: Ant Users List
>> > > Cc: Jan.Materne@rzf.fin-nrw.de
>> > > Betreff: Re: Calling a cmd batch file from Ant
>> > >
>> > > The reason I'm not using ant is that :-
>> > >
>> > > 1. My main build.xml script calls the component.xml script
>> > numerous times.
>> > > 2. Each time the component.xml script is called, the
>> > variable 'component'
>> > > needs to be set to something different.
>> > > 3. Component.xml is generic therefore don't want to hard
>> > code anything
>> > > variables in 4. Once variable set, can't be changed.
>> > >
>> > > Honestly, there is some underlying logic behind all of this.
>> > >
>> > > Chris
>> > >
>> > > On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
>> > >
>> > > > > I am calling a dos batch file from an Ant script using
>> > the following
>> > > > > code :-
>> > > > >
>> > > > > <property name="dos" location="c:/windows/system32/cmd.exe"/>
>> > > > >
>> > > > >
>> > > > > <exec executable="${dos}" dir="c:/build/">
>> > > > >           <arg value="CommonCommponent.bat"/> </exec>
>> > > > >
>> > > > > On the assumption that I get the Microsoft Windows
>> > Copyright info
>> > > > > appear, I assume the above commands are running ok. The
>> > only trouble
>> > > > > is, the contents / commands in the batch file don't seen to
>> > > > > get executed.
>> > > >
>> > > >
>> > > > http://ant.apache.org/faq.html#batch-shell-execute
>> > > >
>> > > >
>> > > > > Batch file contents are :-
>> > > > >
>> > > > > set component=common
>> > > > > ant -f %build.dir%/component.xml
>> > > >
>> > > > Why not use <ant> ?
>> > > >
>> > > >
>> > > > Jan
>> > > >
>> > > >
>> > --------------------------------------------------------------------
>> > -
>> > > > 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
>> > >
>> > >
>> >
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


AW: Calling a cmd batch file from Ant

Posted by "Knuplesch, Juergen" <Ju...@icongmbh.de>.
As far as I undestand: yes.
Only the properties you give inside the task are given to ant or antcall.
The other properties are unset for the called target.




-- 
Jürgen Knuplesch  

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: Chris Green [mailto:chris.green100@googlemail.com] 
Gesendet: Mittwoch, 28. Mai 2008 11:08
An: Ant Users List
Betreff: Re: Calling a cmd batch file from Ant

But doesn't setting the ineritall to false mean that the script you are calling won't have access to properties you have set up ?



On Wed, May 28, 2008 at 11:03 AM, Knuplesch, Juergen < Juergen.Knuplesch@icongmbh.de> wrote:

> But if you use <ANT> or <ANTCALL> it is like you would start  ANT a 
> second time. Therfore the properties are set in the target or script 
> that you call. The old values are lost if you use the attribute 
> Inheritall=false And using <property> inside <Ant> sets some 
> properties to a value you define.
>
>
>
> --
> Jürgen Knuplesch
> -----Ursprüngliche Nachricht-----
> Von: Chris Green [mailto:chris.green100@googlemail.com]
> Gesendet: Mittwoch, 28. Mai 2008 10:56
>  An: Ant Users List
> Betreff: Re: Calling a cmd batch file from Ant
>
> Jan
>
> Unless I'm missing something here, that wouldn't work.
>
> You can't redefine an ant property one it has already been defined in 
> one specific execution of the said script.
>
> That's why I was trying to get the batch file to set up an environment 
> variable before executing the generic component.xml
>
> Chris
>
> On Wed, May 28, 2008 at 10:49 AM, <Ja...@rzf.fin-nrw.de> wrote:
>
> > But in your original post you have specified the component in your 
> > batch file.
> > > > > > Batch file contents are :-
> > > > > >
> > > > > > set component=common
> > > > > > ant -f %build.dir%/component.xml
> >
> > Where is the difference?
> >
> > <project name="master">
> >    <target name="buildComponentOne">
> >        <ant antfile="component.xml">
> >            <property name="component" value="one"/>
> >        </ant>
> >    </target>
> >    <target name="buildComponentTwo">
> >        <ant antfile="component.xml">
> >            <property name="component" value="two"/>
> >        </ant>
> >    </target>
> > </project>
> >
> > <project name="component">
> >    <property file="${component}.properties"/>
> >    <echo> Build one: ${one} </echo>
> >    <echo> Build two: ${two} </echo>
> > </project>
> >
> > one.properties:
> > # Specifies which parts for component 'one' to do one=J two=N
> >
> > two.properties:
> > # Specifies which parts for component 'one' to do one=J two=J
> >
> >
> >
> > Jan
> >
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > > Gesendet: Mittwoch, 28. Mai 2008 10:36
> > > An: Ant Users List
> >  > Betreff: Re: Calling a cmd batch file from Ant
> > >
> > > Can't use ant or antcall's even in a nested structure. Reason 
> > > being
> > > :-
> > >
> > > Script process designed to build numerous components of an 
> > > application.
> > >
> > > Each of these components has a parameter set up in the properties 
> > > file set to Y or N to define whether that component is built 
> > > during that execution of the script.
> > >
> > > Therefore, more than one component may need to be built during one 
> > > execution of the build script.
> > >
> > > On this basis, the controlling ant script, build.xml cannot have 
> > > the component variable defined within it, even nested, as it 
> > > potentially needs to be redefined multiple times.
> > >
> > > The component.xml file (generic) which is called again and again 
> > > for each component that needs to be build. Want to keep this 
> > > generic and as simple as possible. Therefore no hard coding using 
> > > if statements to set the 'component' variable.
> > >
> > > On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen < 
> > > Juergen.Knuplesch@icongmbh.de> wrote:
> > >
> > > > If you use <ant> Task or <antcall>  you can run the target
> > > with different
> > > > content of a property.
> > > > E.g.
> > > >
> > > > <antcall target="your.target" inheritall="false">
> > > >                  <param name="your.property" value="value1" />
> > > >                </antcall>
> > > >
> > > > <antcall target="your.target" inheritall="false">
> > > >                  <param name="your.property" value="value2" />
> > > >                </antcall>
> > > >
> > > > I even use this in <for> loops made with antcontrb.
> > > >
> > > >
> > > >
> > > > --
> > > > Jürgen Knuplesch                    www.icongmbh.de
> > > > icon Systemhaus GmbH                Tel. +49 711 806098-275
> > > > Sophienstraße 40
> > > > D-70178 Stuttgart                   Fax. +49 711 806098-299
> > > >
> > > > Geschäftsführer: Uwe Seltmann
> > > > HRB Stuttgart 17655
> > > > USt-IdNr.: DE 811944121
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > > > Gesendet: Mittwoch, 28. Mai 2008 09:51
> > > > An: Ant Users List
> > > > Cc: Jan.Materne@rzf.fin-nrw.de
> > > > Betreff: Re: Calling a cmd batch file from Ant
> > > >
> > > > The reason I'm not using ant is that :-
> > > >
> > > > 1. My main build.xml script calls the component.xml script
> > > numerous times.
> > > > 2. Each time the component.xml script is called, the
> > > variable 'component'
> > > > needs to be set to something different.
> > > > 3. Component.xml is generic therefore don't want to hard
> > > code anything
> > > > variables in 4. Once variable set, can't be changed.
> > > >
> > > > Honestly, there is some underlying logic behind all of this.
> > > >
> > > > Chris
> > > >
> > > > On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
> > > >
> > > > > > I am calling a dos batch file from an Ant script using
> > > the following
> > > > > > code :-
> > > > > >
> > > > > > <property name="dos" 
> > > > > > location="c:/windows/system32/cmd.exe"/>
> > > > > >
> > > > > >
> > > > > > <exec executable="${dos}" dir="c:/build/">
> > > > > >           <arg value="CommonCommponent.bat"/> </exec>
> > > > > >
> > > > > > On the assumption that I get the Microsoft Windows
> > > Copyright info
> > > > > > appear, I assume the above commands are running ok. The
> > > only trouble
> > > > > > is, the contents / commands in the batch file don't seen to 
> > > > > > get executed.
> > > > >
> > > > >
> > > > > http://ant.apache.org/faq.html#batch-shell-execute
> > > > >
> > > > >
> > > > > > Batch file contents are :-
> > > > > >
> > > > > > set component=common
> > > > > > ant -f %build.dir%/component.xml
> > > > >
> > > > > Why not use <ant> ?
> > > > >
> > > > >
> > > > > Jan
> > > > >
> > > > >
> > > ------------------------------------------------------------------
> > > --
> > > -
> > > > > 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
> > > >
> > > >
> > >
> >
> > --------------------------------------------------------------------
> > - 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
>
>

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


Re: Calling a cmd batch file from Ant

Posted by Chris Green <ch...@googlemail.com>.
But doesn't setting the ineritall to false mean that the script you are
calling won't have access to properties you have set up ?



On Wed, May 28, 2008 at 11:03 AM, Knuplesch, Juergen <
Juergen.Knuplesch@icongmbh.de> wrote:

> But if you use <ANT> or <ANTCALL> it is like you would start  ANT a second
> time. Therfore the properties
> are set in the target or script that you call. The old values are lost if
> you use the attribute
> Inheritall=false
> And using <property> inside <Ant> sets some properties to a value you
> define.
>
>
>
> --
> Jürgen Knuplesch
> -----Ursprüngliche Nachricht-----
> Von: Chris Green [mailto:chris.green100@googlemail.com]
> Gesendet: Mittwoch, 28. Mai 2008 10:56
>  An: Ant Users List
> Betreff: Re: Calling a cmd batch file from Ant
>
> Jan
>
> Unless I'm missing something here, that wouldn't work.
>
> You can't redefine an ant property one it has already been defined in one
> specific execution of the said script.
>
> That's why I was trying to get the batch file to set up an environment
> variable before executing the generic component.xml
>
> Chris
>
> On Wed, May 28, 2008 at 10:49 AM, <Ja...@rzf.fin-nrw.de> wrote:
>
> > But in your original post you have specified the component in your
> > batch file.
> > > > > > Batch file contents are :-
> > > > > >
> > > > > > set component=common
> > > > > > ant -f %build.dir%/component.xml
> >
> > Where is the difference?
> >
> > <project name="master">
> >    <target name="buildComponentOne">
> >        <ant antfile="component.xml">
> >            <property name="component" value="one"/>
> >        </ant>
> >    </target>
> >    <target name="buildComponentTwo">
> >        <ant antfile="component.xml">
> >            <property name="component" value="two"/>
> >        </ant>
> >    </target>
> > </project>
> >
> > <project name="component">
> >    <property file="${component}.properties"/>
> >    <echo> Build one: ${one} </echo>
> >    <echo> Build two: ${two} </echo>
> > </project>
> >
> > one.properties:
> > # Specifies which parts for component 'one' to do one=J two=N
> >
> > two.properties:
> > # Specifies which parts for component 'one' to do one=J two=J
> >
> >
> >
> > Jan
> >
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > > Gesendet: Mittwoch, 28. Mai 2008 10:36
> > > An: Ant Users List
> >  > Betreff: Re: Calling a cmd batch file from Ant
> > >
> > > Can't use ant or antcall's even in a nested structure. Reason being
> > > :-
> > >
> > > Script process designed to build numerous components of an
> > > application.
> > >
> > > Each of these components has a parameter set up in the properties
> > > file set to Y or N to define whether that component is built during
> > > that execution of the script.
> > >
> > > Therefore, more than one component may need to be built during one
> > > execution of the build script.
> > >
> > > On this basis, the controlling ant script, build.xml cannot have the
> > > component variable defined within it, even nested, as it potentially
> > > needs to be redefined multiple times.
> > >
> > > The component.xml file (generic) which is called again and again for
> > > each component that needs to be build. Want to keep this generic and
> > > as simple as possible. Therefore no hard coding using if statements
> > > to set the 'component' variable.
> > >
> > > On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen <
> > > Juergen.Knuplesch@icongmbh.de> wrote:
> > >
> > > > If you use <ant> Task or <antcall>  you can run the target
> > > with different
> > > > content of a property.
> > > > E.g.
> > > >
> > > > <antcall target="your.target" inheritall="false">
> > > >                  <param name="your.property" value="value1" />
> > > >                </antcall>
> > > >
> > > > <antcall target="your.target" inheritall="false">
> > > >                  <param name="your.property" value="value2" />
> > > >                </antcall>
> > > >
> > > > I even use this in <for> loops made with antcontrb.
> > > >
> > > >
> > > >
> > > > --
> > > > Jürgen Knuplesch                    www.icongmbh.de
> > > > icon Systemhaus GmbH                Tel. +49 711 806098-275
> > > > Sophienstraße 40
> > > > D-70178 Stuttgart                   Fax. +49 711 806098-299
> > > >
> > > > Geschäftsführer: Uwe Seltmann
> > > > HRB Stuttgart 17655
> > > > USt-IdNr.: DE 811944121
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > > > Gesendet: Mittwoch, 28. Mai 2008 09:51
> > > > An: Ant Users List
> > > > Cc: Jan.Materne@rzf.fin-nrw.de
> > > > Betreff: Re: Calling a cmd batch file from Ant
> > > >
> > > > The reason I'm not using ant is that :-
> > > >
> > > > 1. My main build.xml script calls the component.xml script
> > > numerous times.
> > > > 2. Each time the component.xml script is called, the
> > > variable 'component'
> > > > needs to be set to something different.
> > > > 3. Component.xml is generic therefore don't want to hard
> > > code anything
> > > > variables in 4. Once variable set, can't be changed.
> > > >
> > > > Honestly, there is some underlying logic behind all of this.
> > > >
> > > > Chris
> > > >
> > > > On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
> > > >
> > > > > > I am calling a dos batch file from an Ant script using
> > > the following
> > > > > > code :-
> > > > > >
> > > > > > <property name="dos" location="c:/windows/system32/cmd.exe"/>
> > > > > >
> > > > > >
> > > > > > <exec executable="${dos}" dir="c:/build/">
> > > > > >           <arg value="CommonCommponent.bat"/> </exec>
> > > > > >
> > > > > > On the assumption that I get the Microsoft Windows
> > > Copyright info
> > > > > > appear, I assume the above commands are running ok. The
> > > only trouble
> > > > > > is, the contents / commands in the batch file don't seen to
> > > > > > get executed.
> > > > >
> > > > >
> > > > > http://ant.apache.org/faq.html#batch-shell-execute
> > > > >
> > > > >
> > > > > > Batch file contents are :-
> > > > > >
> > > > > > set component=common
> > > > > > ant -f %build.dir%/component.xml
> > > > >
> > > > > Why not use <ant> ?
> > > > >
> > > > >
> > > > > Jan
> > > > >
> > > > >
> > > --------------------------------------------------------------------
> > > -
> > > > > 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
> > > >
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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
>
>

AW: Calling a cmd batch file from Ant

Posted by "Knuplesch, Juergen" <Ju...@icongmbh.de>.
But if you use <ANT> or <ANTCALL> it is like you would start  ANT a second time. Therfore the properties
are set in the target or script that you call. The old values are lost if you use the attribute
Inheritall=false
And using <property> inside <Ant> sets some properties to a value you define.



-- 
Jürgen Knuplesch               
-----Ursprüngliche Nachricht-----
Von: Chris Green [mailto:chris.green100@googlemail.com] 
Gesendet: Mittwoch, 28. Mai 2008 10:56
An: Ant Users List
Betreff: Re: Calling a cmd batch file from Ant

Jan

Unless I'm missing something here, that wouldn't work.

You can't redefine an ant property one it has already been defined in one specific execution of the said script.

That's why I was trying to get the batch file to set up an environment variable before executing the generic component.xml

Chris

On Wed, May 28, 2008 at 10:49 AM, <Ja...@rzf.fin-nrw.de> wrote:

> But in your original post you have specified the component in your 
> batch file.
> > > > > Batch file contents are :-
> > > > >
> > > > > set component=common
> > > > > ant -f %build.dir%/component.xml
>
> Where is the difference?
>
> <project name="master">
>    <target name="buildComponentOne">
>        <ant antfile="component.xml">
>            <property name="component" value="one"/>
>        </ant>
>    </target>
>    <target name="buildComponentTwo">
>        <ant antfile="component.xml">
>            <property name="component" value="two"/>
>        </ant>
>    </target>
> </project>
>
> <project name="component">
>    <property file="${component}.properties"/>
>    <echo> Build one: ${one} </echo>
>    <echo> Build two: ${two} </echo>
> </project>
>
> one.properties:
> # Specifies which parts for component 'one' to do one=J two=N
>
> two.properties:
> # Specifies which parts for component 'one' to do one=J two=J
>
>
>
> Jan
>
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > Gesendet: Mittwoch, 28. Mai 2008 10:36
> > An: Ant Users List
>  > Betreff: Re: Calling a cmd batch file from Ant
> >
> > Can't use ant or antcall's even in a nested structure. Reason being 
> > :-
> >
> > Script process designed to build numerous components of an 
> > application.
> >
> > Each of these components has a parameter set up in the properties 
> > file set to Y or N to define whether that component is built during 
> > that execution of the script.
> >
> > Therefore, more than one component may need to be built during one 
> > execution of the build script.
> >
> > On this basis, the controlling ant script, build.xml cannot have the 
> > component variable defined within it, even nested, as it potentially 
> > needs to be redefined multiple times.
> >
> > The component.xml file (generic) which is called again and again for 
> > each component that needs to be build. Want to keep this generic and 
> > as simple as possible. Therefore no hard coding using if statements 
> > to set the 'component' variable.
> >
> > On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen < 
> > Juergen.Knuplesch@icongmbh.de> wrote:
> >
> > > If you use <ant> Task or <antcall>  you can run the target
> > with different
> > > content of a property.
> > > E.g.
> > >
> > > <antcall target="your.target" inheritall="false">
> > >                  <param name="your.property" value="value1" />
> > >                </antcall>
> > >
> > > <antcall target="your.target" inheritall="false">
> > >                  <param name="your.property" value="value2" />
> > >                </antcall>
> > >
> > > I even use this in <for> loops made with antcontrb.
> > >
> > >
> > >
> > > --
> > > Jürgen Knuplesch                    www.icongmbh.de
> > > icon Systemhaus GmbH                Tel. +49 711 806098-275
> > > Sophienstraße 40
> > > D-70178 Stuttgart                   Fax. +49 711 806098-299
> > >
> > > Geschäftsführer: Uwe Seltmann
> > > HRB Stuttgart 17655
> > > USt-IdNr.: DE 811944121
> > > -----Ursprüngliche Nachricht-----
> > > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > > Gesendet: Mittwoch, 28. Mai 2008 09:51
> > > An: Ant Users List
> > > Cc: Jan.Materne@rzf.fin-nrw.de
> > > Betreff: Re: Calling a cmd batch file from Ant
> > >
> > > The reason I'm not using ant is that :-
> > >
> > > 1. My main build.xml script calls the component.xml script
> > numerous times.
> > > 2. Each time the component.xml script is called, the
> > variable 'component'
> > > needs to be set to something different.
> > > 3. Component.xml is generic therefore don't want to hard
> > code anything
> > > variables in 4. Once variable set, can't be changed.
> > >
> > > Honestly, there is some underlying logic behind all of this.
> > >
> > > Chris
> > >
> > > On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
> > >
> > > > > I am calling a dos batch file from an Ant script using
> > the following
> > > > > code :-
> > > > >
> > > > > <property name="dos" location="c:/windows/system32/cmd.exe"/>
> > > > >
> > > > >
> > > > > <exec executable="${dos}" dir="c:/build/">
> > > > >           <arg value="CommonCommponent.bat"/> </exec>
> > > > >
> > > > > On the assumption that I get the Microsoft Windows
> > Copyright info
> > > > > appear, I assume the above commands are running ok. The
> > only trouble
> > > > > is, the contents / commands in the batch file don't seen to 
> > > > > get executed.
> > > >
> > > >
> > > > http://ant.apache.org/faq.html#batch-shell-execute
> > > >
> > > >
> > > > > Batch file contents are :-
> > > > >
> > > > > set component=common
> > > > > ant -f %build.dir%/component.xml
> > > >
> > > > Why not use <ant> ?
> > > >
> > > >
> > > > Jan
> > > >
> > > >
> > --------------------------------------------------------------------
> > -
> > > > 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
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> 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


Re: Calling a cmd batch file from Ant

Posted by Chris Green <ch...@googlemail.com>.
Jan

Unless I'm missing something here, that wouldn't work.

You can't redefine an ant property one it has already been defined in one
specific execution of the said script.

That's why I was trying to get the batch file to set up an environment
variable before executing the generic component.xml

Chris

On Wed, May 28, 2008 at 10:49 AM, <Ja...@rzf.fin-nrw.de> wrote:

> But in your original post you have specified the component in your batch
> file.
> > > > > Batch file contents are :-
> > > > >
> > > > > set component=common
> > > > > ant -f %build.dir%/component.xml
>
> Where is the difference?
>
> <project name="master">
>    <target name="buildComponentOne">
>        <ant antfile="component.xml">
>            <property name="component" value="one"/>
>        </ant>
>    </target>
>    <target name="buildComponentTwo">
>        <ant antfile="component.xml">
>            <property name="component" value="two"/>
>        </ant>
>    </target>
> </project>
>
> <project name="component">
>    <property file="${component}.properties"/>
>    <echo> Build one: ${one} </echo>
>    <echo> Build two: ${two} </echo>
> </project>
>
> one.properties:
> # Specifies which parts for component 'one' to do
> one=J
> two=N
>
> two.properties:
> # Specifies which parts for component 'one' to do
> one=J
> two=J
>
>
>
> Jan
>
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > Gesendet: Mittwoch, 28. Mai 2008 10:36
> > An: Ant Users List
>  > Betreff: Re: Calling a cmd batch file from Ant
> >
> > Can't use ant or antcall's even in a nested structure. Reason being :-
> >
> > Script process designed to build numerous components of an
> > application.
> >
> > Each of these components has a parameter set up in the
> > properties file set
> > to Y or N to define whether that component is built during
> > that execution of
> > the script.
> >
> > Therefore, more than one component may need to be built
> > during one execution
> > of the build script.
> >
> > On this basis, the controlling ant script, build.xml cannot have the
> > component variable defined within it, even nested, as it
> > potentially needs
> > to be redefined multiple times.
> >
> > The component.xml file (generic) which is called again and
> > again for each
> > component that needs to be build. Want to keep this generic
> > and as simple as
> > possible. Therefore no hard coding using if statements to set the
> > 'component' variable.
> >
> > On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen <
> > Juergen.Knuplesch@icongmbh.de> wrote:
> >
> > > If you use <ant> Task or <antcall>  you can run the target
> > with different
> > > content of a property.
> > > E.g.
> > >
> > > <antcall target="your.target" inheritall="false">
> > >                  <param name="your.property" value="value1" />
> > >                </antcall>
> > >
> > > <antcall target="your.target" inheritall="false">
> > >                  <param name="your.property" value="value2" />
> > >                </antcall>
> > >
> > > I even use this in <for> loops made with antcontrb.
> > >
> > >
> > >
> > > --
> > > Jürgen Knuplesch                    www.icongmbh.de
> > > icon Systemhaus GmbH                Tel. +49 711 806098-275
> > > Sophienstraße 40
> > > D-70178 Stuttgart                   Fax. +49 711 806098-299
> > >
> > > Geschäftsführer: Uwe Seltmann
> > > HRB Stuttgart 17655
> > > USt-IdNr.: DE 811944121
> > > -----Ursprüngliche Nachricht-----
> > > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > > Gesendet: Mittwoch, 28. Mai 2008 09:51
> > > An: Ant Users List
> > > Cc: Jan.Materne@rzf.fin-nrw.de
> > > Betreff: Re: Calling a cmd batch file from Ant
> > >
> > > The reason I'm not using ant is that :-
> > >
> > > 1. My main build.xml script calls the component.xml script
> > numerous times.
> > > 2. Each time the component.xml script is called, the
> > variable 'component'
> > > needs to be set to something different.
> > > 3. Component.xml is generic therefore don't want to hard
> > code anything
> > > variables in 4. Once variable set, can't be changed.
> > >
> > > Honestly, there is some underlying logic behind all of this.
> > >
> > > Chris
> > >
> > > On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
> > >
> > > > > I am calling a dos batch file from an Ant script using
> > the following
> > > > > code :-
> > > > >
> > > > > <property name="dos" location="c:/windows/system32/cmd.exe"/>
> > > > >
> > > > >
> > > > > <exec executable="${dos}" dir="c:/build/">
> > > > >           <arg value="CommonCommponent.bat"/> </exec>
> > > > >
> > > > > On the assumption that I get the Microsoft Windows
> > Copyright info
> > > > > appear, I assume the above commands are running ok. The
> > only trouble
> > > > > is, the contents / commands in the batch file don't seen to get
> > > > > executed.
> > > >
> > > >
> > > > http://ant.apache.org/faq.html#batch-shell-execute
> > > >
> > > >
> > > > > Batch file contents are :-
> > > > >
> > > > > set component=common
> > > > > ant -f %build.dir%/component.xml
> > > >
> > > > Why not use <ant> ?
> > > >
> > > >
> > > > Jan
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > 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
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

AW: Calling a cmd batch file from Ant

Posted by Ja...@rzf.fin-nrw.de.
But in your original post you have specified the component in your batch file. 
> > > > Batch file contents are :-
> > > >
> > > > set component=common
> > > > ant -f %build.dir%/component.xml

Where is the difference?

<project name="master">
    <target name="buildComponentOne">
        <ant antfile="component.xml">
            <property name="component" value="one"/>
        </ant>
    </target>
    <target name="buildComponentTwo">
        <ant antfile="component.xml">
            <property name="component" value="two"/>
        </ant>
    </target>
</project>

<project name="component">
    <property file="${component}.properties"/>
    <echo> Build one: ${one} </echo>
    <echo> Build two: ${two} </echo>
</project>

one.properties:
# Specifies which parts for component 'one' to do
one=J
two=N

two.properties:
# Specifies which parts for component 'one' to do
one=J
two=J



Jan



> -----Ursprüngliche Nachricht-----
> Von: Chris Green [mailto:chris.green100@googlemail.com] 
> Gesendet: Mittwoch, 28. Mai 2008 10:36
> An: Ant Users List
> Betreff: Re: Calling a cmd batch file from Ant
> 
> Can't use ant or antcall's even in a nested structure. Reason being :-
> 
> Script process designed to build numerous components of an 
> application.
> 
> Each of these components has a parameter set up in the 
> properties file set
> to Y or N to define whether that component is built during 
> that execution of
> the script.
> 
> Therefore, more than one component may need to be built 
> during one execution
> of the build script.
> 
> On this basis, the controlling ant script, build.xml cannot have the
> component variable defined within it, even nested, as it 
> potentially needs
> to be redefined multiple times.
> 
> The component.xml file (generic) which is called again and 
> again for each
> component that needs to be build. Want to keep this generic 
> and as simple as
> possible. Therefore no hard coding using if statements to set the
> 'component' variable.
> 
> On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen <
> Juergen.Knuplesch@icongmbh.de> wrote:
> 
> > If you use <ant> Task or <antcall>  you can run the target 
> with different
> > content of a property.
> > E.g.
> >
> > <antcall target="your.target" inheritall="false">
> >                  <param name="your.property" value="value1" />
> >                </antcall>
> >
> > <antcall target="your.target" inheritall="false">
> >                  <param name="your.property" value="value2" />
> >                </antcall>
> >
> > I even use this in <for> loops made with antcontrb.
> >
> >
> >
> > --
> > Jürgen Knuplesch                    www.icongmbh.de
> > icon Systemhaus GmbH                Tel. +49 711 806098-275
> > Sophienstraße 40
> > D-70178 Stuttgart                   Fax. +49 711 806098-299
> >
> > Geschäftsführer: Uwe Seltmann
> > HRB Stuttgart 17655
> > USt-IdNr.: DE 811944121
> > -----Ursprüngliche Nachricht-----
> > Von: Chris Green [mailto:chris.green100@googlemail.com]
> > Gesendet: Mittwoch, 28. Mai 2008 09:51
> > An: Ant Users List
> > Cc: Jan.Materne@rzf.fin-nrw.de
> > Betreff: Re: Calling a cmd batch file from Ant
> >
> > The reason I'm not using ant is that :-
> >
> > 1. My main build.xml script calls the component.xml script 
> numerous times.
> > 2. Each time the component.xml script is called, the 
> variable 'component'
> > needs to be set to something different.
> > 3. Component.xml is generic therefore don't want to hard 
> code anything
> > variables in 4. Once variable set, can't be changed.
> >
> > Honestly, there is some underlying logic behind all of this.
> >
> > Chris
> >
> > On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
> >
> > > > I am calling a dos batch file from an Ant script using 
> the following
> > > > code :-
> > > >
> > > > <property name="dos" location="c:/windows/system32/cmd.exe"/>
> > > >
> > > >
> > > > <exec executable="${dos}" dir="c:/build/">
> > > >           <arg value="CommonCommponent.bat"/> </exec>
> > > >
> > > > On the assumption that I get the Microsoft Windows 
> Copyright info
> > > > appear, I assume the above commands are running ok. The 
> only trouble
> > > > is, the contents / commands in the batch file don't seen to get
> > > > executed.
> > >
> > >
> > > http://ant.apache.org/faq.html#batch-shell-execute
> > >
> > >
> > > > Batch file contents are :-
> > > >
> > > > set component=common
> > > > ant -f %build.dir%/component.xml
> > >
> > > Why not use <ant> ?
> > >
> > >
> > > Jan
> > >
> > > 
> ---------------------------------------------------------------------
> > > 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
> >
> >
> 

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


Re: Calling a cmd batch file from Ant

Posted by Chris Green <ch...@googlemail.com>.
Can't use ant or antcall's even in a nested structure. Reason being :-

Script process designed to build numerous components of an application.

Each of these components has a parameter set up in the properties file set
to Y or N to define whether that component is built during that execution of
the script.

Therefore, more than one component may need to be built during one execution
of the build script.

On this basis, the controlling ant script, build.xml cannot have the
component variable defined within it, even nested, as it potentially needs
to be redefined multiple times.

The component.xml file (generic) which is called again and again for each
component that needs to be build. Want to keep this generic and as simple as
possible. Therefore no hard coding using if statements to set the
'component' variable.

On Wed, May 28, 2008 at 10:05 AM, Knuplesch, Juergen <
Juergen.Knuplesch@icongmbh.de> wrote:

> If you use <ant> Task or <antcall>  you can run the target with different
> content of a property.
> E.g.
>
> <antcall target="your.target" inheritall="false">
>                  <param name="your.property" value="value1" />
>                </antcall>
>
> <antcall target="your.target" inheritall="false">
>                  <param name="your.property" value="value2" />
>                </antcall>
>
> I even use this in <for> loops made with antcontrb.
>
>
>
> --
> Jürgen Knuplesch                    www.icongmbh.de
> icon Systemhaus GmbH                Tel. +49 711 806098-275
> Sophienstraße 40
> D-70178 Stuttgart                   Fax. +49 711 806098-299
>
> Geschäftsführer: Uwe Seltmann
> HRB Stuttgart 17655
> USt-IdNr.: DE 811944121
> -----Ursprüngliche Nachricht-----
> Von: Chris Green [mailto:chris.green100@googlemail.com]
> Gesendet: Mittwoch, 28. Mai 2008 09:51
> An: Ant Users List
> Cc: Jan.Materne@rzf.fin-nrw.de
> Betreff: Re: Calling a cmd batch file from Ant
>
> The reason I'm not using ant is that :-
>
> 1. My main build.xml script calls the component.xml script numerous times.
> 2. Each time the component.xml script is called, the variable 'component'
> needs to be set to something different.
> 3. Component.xml is generic therefore don't want to hard code anything
> variables in 4. Once variable set, can't be changed.
>
> Honestly, there is some underlying logic behind all of this.
>
> Chris
>
> On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:
>
> > > I am calling a dos batch file from an Ant script using the following
> > > code :-
> > >
> > > <property name="dos" location="c:/windows/system32/cmd.exe"/>
> > >
> > >
> > > <exec executable="${dos}" dir="c:/build/">
> > >           <arg value="CommonCommponent.bat"/> </exec>
> > >
> > > On the assumption that I get the Microsoft Windows Copyright info
> > > appear, I assume the above commands are running ok. The only trouble
> > > is, the contents / commands in the batch file don't seen to get
> > > executed.
> >
> >
> > http://ant.apache.org/faq.html#batch-shell-execute
> >
> >
> > > Batch file contents are :-
> > >
> > > set component=common
> > > ant -f %build.dir%/component.xml
> >
> > Why not use <ant> ?
> >
> >
> > Jan
> >
> > ---------------------------------------------------------------------
> > 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
>
>

AW: Calling a cmd batch file from Ant

Posted by "Knuplesch, Juergen" <Ju...@icongmbh.de>.
If you use <ant> Task or <antcall>  you can run the target with different content of a property. 
E.g.

<antcall target="your.target" inheritall="false">
 	          <param name="your.property" value="value1" />
 	        </antcall>

<antcall target="your.target" inheritall="false">
 	          <param name="your.property" value="value2" />
 	        </antcall>

I even use this in <for> loops made with antcontrb.



-- 
Jürgen Knuplesch                    www.icongmbh.de
icon Systemhaus GmbH                Tel. +49 711 806098-275
Sophienstraße 40                    
D-70178 Stuttgart                   Fax. +49 711 806098-299

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: Chris Green [mailto:chris.green100@googlemail.com] 
Gesendet: Mittwoch, 28. Mai 2008 09:51
An: Ant Users List
Cc: Jan.Materne@rzf.fin-nrw.de
Betreff: Re: Calling a cmd batch file from Ant

The reason I'm not using ant is that :-

1. My main build.xml script calls the component.xml script numerous times.
2. Each time the component.xml script is called, the variable 'component'
needs to be set to something different.
3. Component.xml is generic therefore don't want to hard code anything variables in 4. Once variable set, can't be changed.

Honestly, there is some underlying logic behind all of this.

Chris

On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:

> > I am calling a dos batch file from an Ant script using the following 
> > code :-
> >
> > <property name="dos" location="c:/windows/system32/cmd.exe"/>
> >
> >
> > <exec executable="${dos}" dir="c:/build/">
> >           <arg value="CommonCommponent.bat"/> </exec>
> >
> > On the assumption that I get the Microsoft Windows Copyright info 
> > appear, I assume the above commands are running ok. The only trouble 
> > is, the contents / commands in the batch file don't seen to get 
> > executed.
>
>
> http://ant.apache.org/faq.html#batch-shell-execute
>
>
> > Batch file contents are :-
> >
> > set component=common
> > ant -f %build.dir%/component.xml
>
> Why not use <ant> ?
>
>
> Jan
>
> ---------------------------------------------------------------------
> 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


Re: Calling a cmd batch file from Ant

Posted by Chris Green <ch...@googlemail.com>.
The reason I'm not using ant is that :-

1. My main build.xml script calls the component.xml script numerous times.
2. Each time the component.xml script is called, the variable 'component'
needs to be set to something different.
3. Component.xml is generic therefore don't want to hard code anything
variables in
4. Once variable set, can't be changed.

Honestly, there is some underlying logic behind all of this.

Chris

On Wed, May 28, 2008 at 9:41 AM, <Ja...@rzf.fin-nrw.de> wrote:

> > I am calling a dos batch file from an Ant script using the
> > following code :-
> >
> > <property name="dos" location="c:/windows/system32/cmd.exe"/>
> >
> >
> > <exec executable="${dos}" dir="c:/build/">
> >           <arg value="CommonCommponent.bat"/>
> > </exec>
> >
> > On the assumption that I get the Microsoft Windows Copyright
> > info appear, I
> > assume the above commands are running ok. The only trouble
> > is, the contents
> > / commands in the batch file don't seen to get executed.
>
>
> http://ant.apache.org/faq.html#batch-shell-execute
>
>
> > Batch file contents are :-
> >
> > set component=common
> > ant -f %build.dir%/component.xml
>
> Why not use <ant> ?
>
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

AW: Calling a cmd batch file from Ant

Posted by Ja...@rzf.fin-nrw.de.
> I am calling a dos batch file from an Ant script using the 
> following code :-
> 
> <property name="dos" location="c:/windows/system32/cmd.exe"/>
> 
> 
> <exec executable="${dos}" dir="c:/build/">
>           <arg value="CommonCommponent.bat"/>
> </exec>
> 
> On the assumption that I get the Microsoft Windows Copyright 
> info appear, I
> assume the above commands are running ok. The only trouble 
> is, the contents
> / commands in the batch file don't seen to get executed.


http://ant.apache.org/faq.html#batch-shell-execute


> Batch file contents are :-
> 
> set component=common
> ant -f %build.dir%/component.xml

Why not use <ant> ?


Jan

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