Skip to content

Instantly share code, notes, and snippets.

@abythell
Last active November 7, 2016 23:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save abythell/5000397 to your computer and use it in GitHub Desktop.
Save abythell/5000397 to your computer and use it in GitHub Desktop.
Ant script to download and configure the Netbeans platform, which enables Netbeans platform applications to be built without the IDE
<!--
Netbeans Platform Download-and-Config
Copyright 2013, 2016, Andrew Bythell <abythell@ieee.org>
http://angryelectron.com/
This Ant script is used to download and configure the Netbeans platform,
allowing Netbeans platform applications to be built without the IDE.
-->
<project name="configure-platform" default="configure" basedir=".">
<!--
User-settings
-->
<property name="version" value="8.1"/>
<!--
These don't need to modified
-->
<path id="basedir.path"> <pathelement path="${basedir}" /> </path>
<pathconvert targetos="unix" property="basedir.unix" refid="basedir.path"/>
<property name="netbeans" value="${basedir.unix}/netbeans-${version}"/>
<property name="bootstrap.url" value="http://deadlock.netbeans.org/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/netbeans/harness/tasks.jar"/>
<property name="netbeans.updatecenter.url" value="http://updates.netbeans.org/netbeans/updates/${version}/uc/final/distribution/catalog.xml.gz"/>
<!--
Download the Netbeans platform and build harness
-->
<target name="download">
<mkdir dir="${netbeans}/harness"/>
<get
src="${bootstrap.url}"
dest="${netbeans}/harness/tasks.jar"
usetimestamp="true"
verbose="true"
/>
<taskdef name="autoupdate"
classname="org.netbeans.nbbuild.AutoUpdate"
classpath="${netbeans}/harness/tasks.jar"
/>
<autoupdate installdir="${netbeans}" updatecenter="${netbeans.updatecenter.url}">
<modules includes=".*" clusters="harness[0-9]*"/>
<modules includes=".*" clusters="platform[0-9]*"/>
</autoupdate>
</target>
<!--
Configure the Netbeans build harness to use the downloaded platform
-->
<target name="configure" depends="download">
<mkdir dir="nbproject/private"/>
<echo file="nbproject/private/platform-private.properties">user.properties.file=${basedir.unix}/nbproject/private/build.properties${line.separator}</echo>
<echo file="nbproject/private/build.properties">nbplatform.default.harness.dir=${nbplatform.default.netbeans.dest.dir}/harness${line.separator}</echo>
<echo file="nbproject/private/build.properties" append="true">nbplatform.default.netbeans.dest.dir=${netbeans}${line.separator}</echo>
</target>
<!--
Remove the downloaded platform and build harness. This allows the Netbeans IDE to set the paths
to the stock values.
-->
<target name="clean">
<delete dir="nbproject/private" />
<delete dir="${netbeans}" />
</target>
</project>
@isijara
Copy link

isijara commented Feb 9, 2016

Hello @abythell, there is a little mistake in your script.
Line :23
There is a whitespace between /artifact nbbuild/
Your script has been really helpful, but still struggling to complete the build.

Cheers!

@abythell
Copy link
Author

abythell commented Nov 7, 2016

Noted and corrected. Fixed outdated URLs. Updated to use platform version 8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment