Wow, what a cool answer :) Thank you! :) > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Donnerstag, 27. Oktober 2005 11:59 > To: [email protected] > Subject: AW: How to call an ant script with parameters? > > Use properties: > ant -f MyAntScript.xml MyTarget -Dparam1=MyParameter1 > -Dparam2=MyParameter2 Access in Ant: ${param1} ${param2} > > see also > passing parameters to ant > http://marc.theaimsgroup.com/?l=ant-user&m=110545745615637&w=2 > > > > I think I had done something ... yes in 2003. > Mmh - maybe > http://marc.theaimsgroup.com/?l=ant-user&m=104986536231693&w=2 ... > > > Jan > > > > Here the 2003-code :-) But works with Ant 1.6 also. > > -- ant2.bat > --8-<-------8-<-------8-<-------8-<-------8-<-------8-<------- > 8-<-------8-<---- > @echo off > > if "%1"=="process" goto process > goto normal > > > > :process > shift > set opts= > set i=1 > > :loop > if "%1"=="" goto run > set opts=%opts% -Dargs.%i%=%1 > set /A "i+=1" > shift > goto loop > > :run > call ant process %opts% > goto end > > :normal > call ant %* > > :end > -- build.xml > -8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8 > -<-------8-<---- > <project default="main"> > <target name="main"> > <echo>main</echo> > </target> > > <target name="process"> > <echo> > 1 = ${args.1} > 2 = ${args.2} > 3 = ${args.3} > 4 = ${args.4} > 5 = ${args.5} > 6 = ${args.6} > 7 = ${args.7} > 8 = ${args.8} > 9 = ${args.9} > 10 = ${args.10} > </echo> > </target> > </project> > -- test > -8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8 > -<-------8-<----8-<-- > C:\ant\anttests\wrapperscript>ant2 > Buildfile: build.xml > > main: > [echo] main > > BUILD SUCCESSFUL > Total time: 0 seconds > C:\ant\anttests\wrapperscript>ant2 hello world > Buildfile: build.xml > > BUILD FAILED > Target `hello' does not exist in this project. > > Total time: 0 seconds > C:\ant\anttests\wrapperscript>ant2 process hello world > Buildfile: build.xml > > process: > [echo] > [echo] 1 = hello > [echo] 2 = world > [echo] 3 = ${args.3} > [echo] 4 = ${args.4} > [echo] 5 = ${args.5} > [echo] 6 = ${args.6} > [echo] 7 = ${args.7} > [echo] 8 = ${args.8} > [echo] 9 = ${args.9} > [echo] 10 = ${args.10} > [echo] > > BUILD SUCCESSFUL > Total time: 0 seconds > > C:\ant\anttests\wrapperscript> > ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<------ > -8-<-------8-<-----------8-<- > > > > > >-----Ursprüngliche Nachricht----- > >Von: Remo Liechti [mailto:[EMAIL PROTECTED] > >Gesendet: Donnerstag, 27. Oktober 2005 11:21 > >An: Ant Users List > >Betreff: How to call an ant script with parameters? > > > >Hi all > >I didnt find an answer to this in the documentaion or in the > >mailinglist > >archive: > > > >To run a ant script, I have to call it like this: > > > >Ant -buildfile MyAntScript.xml MyTarget > > > >I call my ant script using batch files on windows. Now I need to set > >some parameters to the ant script dynamicly, like: > > > >Ant -buildfile MyAntScript.xml MyTarget MyParameter1 MyParameter2 > > > >And so on. How do I access such parameters inside of > MyAntScript.xml? > >Is it possible? > >Cause of ant's syntax, MyParameter1 and 2 would be another > target... :/ > > > >Remo > > > >____________________________________________________________ > >This message may contain legally privileged or confidential > information > >and is therefore addressed to the named persons only. > >The recipient should inform the sender and delete this message, if > >he/she is not named as addressee. > >The sender disclaims any and all liability for the integrity and > >punctuality of this message. > >The sender has activated an automatic virus scanning by Messagelabs, > >but does not guarantee the virus free transmission of this message. > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] For > additional > >commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] For > additional commands, e-mail: [EMAIL PROTECTED] > > > ____________________________________________________________ > This message has been checked for all known viruses by Messagelabs. >
____________________________________________________________ This message may contain legally privileged or confidential information and is therefore addressed to the named persons only. The recipient should inform the sender and delete this message, if he/she is not named as addressee. The sender disclaims any and all liability for the integrity and punctuality of this message. The sender has activated an automatic virus scanning by Messagelabs, but does not guarantee the virus free transmission of this message. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
