You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by da...@remanresource.com on 2009/02/18 18:17:12 UTC

Reading a property from a file

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/ProvisioningAccountService/ProvisioningAccountService?WSDL


How can I tell ant to get the value from there?

Thanks,  - Dave

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


Re: Reading a property from a file

Posted by David Weintraub <qa...@gmail.com>.
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/ProvisioningAccountService/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,  <da...@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/ProvisioningAccountService/ProvisioningAccountService?WSDL
>
>
> How can I tell ant to get the value from there?
>
> Thanks,  - Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
--
David Weintraub
qazwart@gmail.com

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