Wednesday, June 3, 2015

Customizing the Netbeans RPC Installer for Product Version

If you build a NetBeans RCP application using the NetBeans platform the "Package As" menu option, you'll find that when you build a new version of the application, users are unable to install it. The Netbeans installer will not re-install and application and it "thinks" that the new install, is the same version as the old install. This is because of a hard-coded (1.0.0.0.0) string in the following files, which are used to create the installation package:

product.version in {nbdir}\harness\nbi\stub\ext\infra\build\products\helloworld\build.properties

and the version attribute in <create-bundle> <component in {nbdir}\harness\nbi\stub\build.xml



To make this dynamic, so you can change versions from your build, you will need to modify the following files:

in {nbdir}\harness\nbi\stub\ext\infra\build\products\helloworld\build.properties

change 67 to:

#Changed from the hard coded "1.0.0.0.0"
product.version={product-version}


on line 166 in {nbdir}\harness\nbi\stub\build.xml


<component uid="${main.product.uid}" version="${product-version}"/> <!-- changed version to version="${product-version}" from hard coded string version="1.0.0.0.0"-->


In template.xml:

after line 141, 131 and 122 add the following:

<replacefilter token="{product-version}"     value="${product-version}"/> <!-- Added to do the substitution -->

after line 84:

<property name="product-version"  value="${suite.props.app.version}"/>


And finally, in {project}\nbproject\project.properties"

add:
# application / product version MUST be formated as N.N.N.N.N
app.version=15.0.0.0.0


Since you've changed Netbeans "installed" code, you might want to place it under version control.

This shouldn't be so hard. But like everything else in Netbeans, there you have it. Your new install will over-right your old ones now.



No comments:

Post a Comment