开发者

Get list of files from URL

I'll like to automate somehow keeping my Netbeans Daily build with what's available.

Basically is as follows:

  1. Get file list from http://bits.netbeans.org/download/trunk/nightly/latest/zip/
  2. Download file (let's say I'm interested in the java.zip)
  3. Unzip

I have an ant script capable of doing 2 and 3. I need to figure out how to do the first. See below:

<?xml version="1.0" encoding="UTF-8"?>
<project name="Netbeans Daily Build" basedir=".">
<description>Updates the daily build</description>
<property name="zip.name" value="netbeans-6.9.1-201007282301-ml-javase.zip"/>
<property name="dist" value="Z:/Program Files/Netbeans 7.0/"/>
<property name="zip.url"    value="http://bits.netbeans.org/download/trunk/nightly/latest/zip/"/>
<fileset id="ant-contrib-jar" dir="./">
    <include name="ant-contrib-*.jar" />
</fileset>
<pathconvert property="ant-contrib-jar" refid="ant-contrib-jar" pathsep="," />
<basename property="ant-contrib-filename" file="${ant-contrib-jar}"/>
<property name="ant-contrib-loc" value="./${ant-contrib-filename}"/>
<available file="${ant-contrib-loc}" property="ant-contrib.present"/>
<fail unless="ant-contrib.present" message="The ant-contrib jar doesn't exist at: ${ant-contrib-loc}, can't build. Check your settings!" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
    <classpath>
        <pathelement location="${ant-contrib-loc}"/>
    </classpath>
</taskdef>
<!--Delete old copies of platforms-->
<delete>
    <fileset dir="${dist}" includes="**/*.zip" excludes="${zip.name}"/>
</delete>
<available file="${zip.url}${zip.name}" property="file.exists"/>
<if> 
    <not>
        <isset property="file.exists"/>
    </not>
    <then>
        <get src="${zip.url}${zip.name}" dest="./" skipexisting="true" verbose="true"/>
        <!--Only overwrite if newer
        <unzip src="${dist}/${zip.name}" dest="${dist}" overwrite="false"/>-->
    </then>
</if>
</project>

I need to somehow figure out the correct file name to download. Doing everything in a batch file (without ant) is acceptable as well.

开发者_StackOverflowThanks in advance!


How about you just check out the latest version using mercurial? This should tell you how: http://netbeans.org/community/sources/hg.html


Looks like there's a project for this. Looks like I'll be joining the team...

http://kenai.com/projects/nb-nightly-updater

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜