Over a million developers have joined DZone.

Extending the Downloadable NetBeans Platform for ANT Builds Feature

DZone's Guide to

Extending the Downloadable NetBeans Platform for ANT Builds Feature

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

I saw the great article by Toni Epple and got really interested in the Downloadable NetBeans Platform for ANT builds feature. I already wondered what the platform.download task was since NetCat 7.1. So I had some questions: How will this work with custom platforms? For example my project works with the NB platform and some additional projects? Anyway, I wrote a couple of issues around that:


Please vote on them if interested.

Sadly issue 207738 is already rejected. So I had to work around it on my own.

If you read the issue, it basically asks for this feature to be more flexible by allowing configuration to download other plugins as well. (Right now you can use one update catalog).

So I ended up with this approach: Following Toni's article I added the following properties to my suite's platform.properties file:




And then follow up with the alternate urls to get updates from.



Basically the following modified platform.xml file will try to download the plug-ins from all those urls so you just need to add one that covers all the added plugins.

<?xml version="1.0" encoding="UTF-8"?>
<project name="platform" default="download" basedir="..">
    <import file="../preparation.xml"/>
    <condition property="download.enabled">
            <isset property="bootstrap.url"/>
            <isset property="autoupdate.catalog.url"/>
    <condition property="download.harness.required">
                <available file="${harness.dir}/suite.xml"/>
            <isset property="download.enabled"/>
    <target name="download-harness" if="download.harness.required">
        <mkdir dir="${harness.dir}"/>
        <autoupdate installdir="${nbplatform.active.dir}" updatecenter="${autoupdate.catalog.url}">
            <modules includes="org[.]netbeans[.]modules[.]apisupport[.]harness" clusters="harness"/>
    <target name="download" depends="init-netbeans, init-hudson" if="download.enabled">
        <pathconvert pathsep="|" property="download.clusters">
            <mapper type="flatten"/>
            <path path="${cluster.path}"/>
        <property name="disabled.modules" value=""/>
        <pathconvert property="module.includes" pathsep="">
            <mapper type="glob" from="${basedir}${file.separator}*" to="(?!\Q*\E)"/>
                <filelist files="${disabled.modules}" dir="."/>
        <property file="nbproject/platform.properties" prefix="urls."/>
        <propertyselector property="urls" match="urls.autoupdate.catalog\.(.*)" select="\1"/>

        <property file="nbproject/platform.properties"/>
        <echo message="Downloading clusters ${download.clusters}"/>
        <property name="tasks.jar" location="${java.io.tmpdir}/tasks.jar"/>
        <get src="${bootstrap.url}" dest="${tasks.jar}" usetimestamp="true" verbose="true"/>
        <taskdef name="autoupdate" classname="org.netbeans.nbbuild.AutoUpdate" classpath="${tasks.jar}"/>
        <antcall target="download-harness"/>
        <for list="${urls}" param="url">
                <echo message="Attempting to download plug-ins from ${autoupdate.catalog.@{url}}" />
                <download-platform url="${autoupdate.catalog.@{url}}"/>
        <mkdir dir="${nbplatform.active.dir}/extra"/>
        <autoupdate todir="${nbplatform.active.dir}/extra">
            <nbms dir="../netbeans">
                <include name="*.nbm"/>
            <modules includes=".+"/>
    <macrodef name="download-platform">
        <attribute name="url"/>
            <autoupdate installdir="${nbplatform.active.dir}" updatecenter="@{url}">
                <modules includes="${module.includes}.*" clusters="${download.clusters}"/>
                <modules includes="org[.]netbeans[.]modules[.]apisupport[.]harness" clusters="harness"/>

Note: this script uses the ant-contrib library, so make sure to have it defined. Also I would suggest having the NetBeans url last so it gets all other dependencies.

Hope you find it useful!

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}