Search code examples
javahttppropertiesantget

Set ANT property from the response of a HTTP GET request


I am new to ANT and I need to get a way to read the output of a HTTP GET request into a property so I can use it later in the build script.

I tried using https://ant.apache.org/manual/Tasks/get.html but found no parameters available. I am using ant 1.9.6 and latest ant contrib version

Thanks!


Solution

  • Use the <loadresource> task with a nested <url> resource:

    <loadresource property="content">
        <url url="https://google.com"/>
    </loadresource>