You now have the NetBeans Platform as well as its build harness. Let's start using it.
project.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project.suite</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-suite-project/1">
<name>DemoApp</name>
</data>
</configuration>
</project>
platform.properties
nbplatform.active.dir=/home/geertjan/projects/platform-zip/
harness.dir=${nbplatform.active.dir}/harness
cluster.path=${nbplatform.active.dir}/platform
disabled.modules=
app.name=demoapp
branding.token=${app.name}
modules=
The 'nbplatform.active.dir' above points to the folder where I unzipped the two downloads into.
build-impl.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="DemoApp-impl" basedir=".." xmlns:sproject="http://www.netbeans.org/ns/nb-module-suite-project/1">
<property file="nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
<attribute name="property"/>
<attribute name="value"/>
<sequential>
<property name="@{property}" value="@{value}"/>
</sequential>
</macrodef>
<sproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
<sproject:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
<sproject:evalprops property="cluster.path.evaluated" value="${cluster.path}"/>
<import file="${harness.dir}/suite.xml"/>
</project>
The above files, within the 'nbproject' folder, are all that's needed to hook the 'platform' and 'harness' downloads into your project.
<?xml version="1.0" encoding="UTF-8"?>
<project name="DemoApp" basedir=".">
<description>Builds the module suite DemoApp.</description>
<import file="nbproject/build-impl.xml"/>
</project>
That's it. Go to the project's root directory and do 'ant run'. The NetBeans Platform will start up and you'll see the main window. When troubleshooting the above scenario, make sure the 'platform' and 'harness' folders are really in a different folder to where the 'DemoApp' is in, e.g., 'home/nbplatform/platform' and 'home/nbplatform/harness', with 'home/mywork/DemoApp' is what is needed.
Next time, we'll look at how to add a module to the application.
In case the links do not work, add "&pagelang=" at the end of the link:
http://netbeans.org/downloads/start.html?filename=zip/moduleclusters/netbeans-6.9-201006101454-ml-platform.zip&pagelang=
http://netbeans.org/downloads/start.html?filename=zip/moduleclusters/netbeans-6.9-201006101454-ml-harness.zip&pagelang=
Is there a way this could be accomplished via a Maven archetype instead (no Ant build.xml)?
We use Maven as our build system, which is one of the main reasons we're not tied to a particular IDE going forward.
Hi Jacek!
Yes, the NetBeans platform is available as maven artifacts. I build my rcp projects with maven and hudson (in conjunction with artifactory).
br, josh.
That post title was too shocking for me. Please be careful - you could cause heart attacks...
Martin> Yes, mee too!
Thanks, that was really useful!
I found a way for having the nbplatform folder in the project folder and not to have to put an absolute path as active dir. Simply add this at the top of your build.xml file:
<property name="nbplatform.active.dir" value="${basedir}/nbplatform" />
And set your platform.properties like this:
nbplatform.active.dir=${suite.dir}/nbplatform
harness.dir=${nbplatform.active.dir}/harness
cluster.path=${nbplatform.active.dir}/platform