Question

We're developing a netbeans platform that we're using as a basis for other netbeans platforms. It would be very nice to have a Ant target that could install it in the current netbeans environment as a platform.

Atm we'd have to do Tools -> NetBeans Platforms -> Add platform and so forth, when we're doing it manually.

In the build server (jenkins) we have to have a batch script that modifies build.properties. It's rather messy...

In an ideal world I'd be able to do it with Ant, but I don't know Ant at all so I wonder... Is there a way?

Was it helpful?

Solution

This was quite easy once I looked into ant!

When I build the "base platform" I do this as the final ant target;

<target name ="install-as-platform-into-netbeans" depends="build-zip">
        <unzip src="${basedir}/dist/${ant.project.name}.zip" dest="${basedir}/dist"/> 
        <propertyfile file="${user.properties.file}">
            <entry key="nbplatform.${ant.project.name}.harness.dir" value="${nbplatform.default.harness.dir}"/>
            <entry key="nbplatform.${ant.project.name}.label" value="${ant.project.name}"/>
            <entry key="nbplatform.${ant.project.name}.netbeans.dest.dir" value="${basedir}/dist/${ant.project.name}"/>
            <entry key="nbplatform.${ant.project.name}.sources" value="${basedir}"/>
        </propertyfile>

And then I have to set this platform as the 'active platform' in the second build;

   <target name="set-as-active-platform">
         <propertyfile file="${basedir}/nbproject/platform.properties">
               <entry key="nbplatform.active" value="NAME-OF-PREVIOUS-PLATFORM"/>
         </propertyfile>
    </target>

One obvious downside is that I have to have the name of the previous platform coded into NAME-OF-PREVIOUS-PLATFORM, but the name doesnt change very often so it's no big deal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top