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:
- Get file list from http://bits.netbeans.org/download/trunk/nightly/latest/zip/
- Download file (let's say I'm interested in the java.zip)
- 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
精彩评论