> -----Original Message----- > From: dave.alvar...@remanresource.com > [mailto:dave.alvar...@remanresource.com] > Sent: Thursday, February 19, 2009 10:00 AM > To: Ant Users List > Subject: Re: AW: Reading a property from a file > > Again, I really appreciate all the advice I'm getting, but being so > inexperienced with Ant, I'm still missing the solution. > > The properties file I refer to is not in any way related to my Ant tasks. > But it does contain a URL I would like to use in my Ant script, so I can > keep that URL in one place. > > So what are the commands/XML to extract the key in the following key-value > pair ... > > PROVISIONING_SERVICE_WSDL_URL=http://99.99.99.99:9999/ProvisioningAccountS > ervice/ProvisioningAccountService?WSDL > > in my "file.properties" file that will allow me to plug in that URL into > the "wsdl" attribute of my "<clientgen>" task? > > Thanks, - Dave > We understand that your properties file is in no way related to you Ant tasks. However, the way to get the data out of is it using Ant tasks, namely the <property> task. This is explained all very clearly in the Ant manual: http://ant.apache.org/manual/index.html See Ant Tasks->Core Tasks->Property
None the less here is a simple Ant example: <!-- load my properties file --> <property file="file.properties" /> <!-- access the property I need --> <clientgen wsdl="${PROVISIONING_SERVICE_WSDL_URL}" /> <!-- alternative method --> <property name="wsdl.url" value="${PROVISIONING_SERVICE_WSDL_URL}" /> <clientgen wsdl="${wsdl.url}" /> -raleigh > > > -------Original Message------- > > From: jan.mate...@rzf.fin-nrw.de > > Subject: AW: Reading a property from a file > > Sent: Feb 19 '09 06:16 > > > > <property> is a task as all others, therefore you can use that > everywhere. If your properties file contains 'just' properties for that > generation, placing the task just in front of the <clientgen> is a good > idea. > > Usually you have a build.properties with all properties for the build, > like java source directory, javac target, etc. Then a common place is > directly under <project>. > > > > > > Jan > > > > > > >-----Ursprüngliche Nachricht----- > > >Von: dave.alvar...@remanresource.com > > >[mailto:dave.alvar...@remanresource.com] > > >Gesendet: Mittwoch, 18. Februar 2009 19:26 > > >An: Ant Users List > > >Betreff: Re: Reading a property from a file > > > > > >Thanks for your reply. Regarding the property file directive, > > >"<property>", where are you actually loading the property > > >"PROVISIONING_SERVICE_WSDL_URL" from the file and assigning it > > >to a variable? > > > > > > - Dave > > > > > >> -------Original Message------- > > >> From: David Weintraub <qazw...@gmail.com> > > >> Subject: Re: Reading a property from a file > > >> Sent: Feb 18 '09 18:10 > > >> > > >> What about <property file="Property_File_Name"/> ? > > >> > > >> What I normally do is something like this: > > >> > > >> <property name="property.file" > > >> value="${basedir}/default_property_file_name.properties"/> > > >> <property file=${property.file}"/> > > >> > > >> That way, I can put the property file name on the command line, or > > >> read in the default property file if it exists. > > >> > > >> You can also override any property setting in your > > >build.xml by simply > > >> placing it on the command line: > > >> > > >> So do this: > > >> > > >> <target name="gen-web-svc-client-jar"> > > >> <property name="provisioning.service.wsdl.file" > > >> > > >name="${basedir}/wsdl_files/ProvisioningService.wsdl > > >> <clientgen > > >> > > >wsdl="${provisioning.service.wsdl.file}" > > >> > > >> destFile="${deployment}/APP-INF/lib/ProvisioningServiceClient.jar" > > >> > > >> packageName="com.myco.nps.regui.provisioning.client" > > >> > serviceName="ProvisioningService" > > >> .... > > >> > > >> Then you can do this on the command line: > > >> > > >> $ ant > > >-Dprovisioning.service.wsdl.file=http://99.99.99.99:9999/Provis > > >ioningAccountService/ProvisioningAccountService?WSDL > > >> > > >> The <property> task that sets provisioning.service.wsdl.file will > be > > >> overridden by the command line setting. > > >> > > >> On Wed, Feb 18, 2009 at 12:17 PM, > > <dave.alvar...@remanresource.com> wrote: > > >> > Hi, > > >> > > > >> > I'm uisng Ant 1.6. I have this target ... > > >> > > > >> > <target name="gen-web-svc-client-jar"> > > >> > <clientgen > > >> > > > >wsdl="${basedir}/wsdl_files/ProvisioningService.wsdl" > > >> > > > >destFile="${deployment}/APP-INF/lib/ProvisioningServiceClient.jar" > > >> > > > >packageName="com.myco.nps.regui.provisioning.client" > > >> > > > >serviceName="ProvisioningService" > > >> > classpath="${java.class.path}" > > >> > > > > >> > <classpath> > > >> > <path refid="project.class.path" /> > > >> > </classpath> > > >> > </clientgen> > > >> > </target> > > >> > > > >> > For the property, > > >'wsdl="${basedir}/wsdl_files/ProvisioningService.wsdl"', I > > >would prefer to read this property out of a properties file I > > >have, which has the line ... > > >> > > > >> > > > >PROVISIONING_SERVICE_WSDL_URL=http://99.99.99.99:9999/Provision > > >ingAccountService/ProvisioningAccountService?WSDL > > >> > > > >> > > > >> > How can I tell ant to get the value from there? > > >> > > > >> > Thanks, - Dave > > >> > > > >> > > > >--------------------------------------------------------------------- > > >> > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > > >> > For additional commands, e-mail: user-h...@ant.apache.org > > >> > > > >> > > > >> > > >> > > >> > > >> -- > > >> -- > > >> David Weintraub > > >> qazw...@gmail.com > > >> > > >> > > >--------------------------------------------------------------------- > > >> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > > >> For additional commands, e-mail: user-h...@ant.apache.org > > >> > > >> > > > > > >--------------------------------------------------------------------- > > >To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > > >For additional commands, e-mail: user-h...@ant.apache.org > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > > For additional commands, e-mail: user-h...@ant.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org