User Tools

Site Tools


how_to_sign_your_netbeans_modules_automatically

How to self-sign your Netbeans Modules Automatically

This is a necessary step to providing your modules to the public via the Netbeans Plugin Portal. This assumes you have more than one module and that your modules are grouped into a suite. I suppose if you had one module you could create a 1-module suite and these instructions would also work in this case.

Process:

  1. Get a copy of the ant-contrib library. I downloaded “ant-contrib-1.0b3.jar” (http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/)
  2. Place the “ant-contrib-1.0b3.jar” file in your module suite
  3. Insert the “suite.-init” and “update-keystore-info” targets into the build.xml file of your suite as detailed below.
  4. Modify the <pathelement location=“ROSProjectType/release/modules/ext/ant-contrib-1.0b3.jar”/> line to point to the relative path (from the suite folder) to your “ant-contrib-1.0b3.jar” file.
  5. Edit your nbproject/project.properties file as detailed below.
  6. Edit your nbproject/private/project-private.properties file as detailed below.
  7. Try the “Packages as→NMBs” option from your module suite drop down.

Hope it works for you!

Insert into the bottom of your build.xml file of your module suite (before the closing project tag)
    <taskdef resource="net/sf/antcontrib/antlib.xml">
        <classpath>
            <pathelement location="ROSProjectType/release/modules/ext/ant-contrib-1.0b3.jar"/>
        </classpath>
    </taskdef>
 
    <target name="-init" depends="suite.-init">
        <!--Create/Update keystore-->
        <delete file="${keystore.location}${keystore.name}"/>
        <mkdir dir="${keystore.location}"/>
        <!-- <echo message="${keystore.location}"/> -->
        <genkey alias="${keystore.alias}" storepass="${keystore.password}"
                dname="${keystore.dname}"
                keystore="${keystore.location}${keystore.name}"
                verbose="true" validity="365"/>
        <!--Update keystore info in projects-->
        <antcall target="update-keystore-info"/>
    </target>
 
    <target name="update-keystore-info">
        <!-- <echo message="${modules}, ${keystore.location}, ${keystore.name}, ${keystore.password}"/> -->
        <for list="${modules}" delimiter=":" param="cur" trim="true">
            <sequential>
                <!-- <echo message="${cur}"/> -->
                <mkdir dir="@{cur}/nbproject/"/>
                <!--Place the information in the properties file-->
                <propertyfile file="@{cur}/nbproject/project.properties">
                    <entry  key="keystore" value="../${keystore.location}${keystore.name}"/>
                    <entry  key="nbm_alias" value="${keystore.alias}"/>
                </propertyfile>
                <mkdir dir="@{cur}/nbproject/private/"/>
                <!--Place the password in the private properties file-->
                <propertyfile file="@{cur}/nbproject/private/platform-private.properties">
                    <entry  key="storepass" value="${keystore.password}"/>
                </propertyfile>
            </sequential>
        </for>    
    </target>

The fields you need to add to your project.properties file (in the nbfolder in your suite's home directory) are as follows:

Add these lines to your nbproject/project.properties file
keystore.dname=CN=<your Name>, OU=<your Organization Unit>, O=<your Organization>, C=<your Country>
keystore.location=nbproject/private/
keystore.name=keystore
keystore.alias=<your alias>
keystore.password=<yourpassword>

For those in the United States set <your Country> to US.

You also need to add a storepassword entry to your private project properties. To do so edit the “nbproject/private/platform-private.properties” file. Add the following entry:

Add this line to your nbproject/private/platform-private.properties file
storepass=<yourpassword>

Note the keystore.password in “nbproject/platform.properties” storepass in “nbproject/private/platform-private.properties” need to match.

how_to_sign_your_netbeans_modules_automatically.txt · Last modified: 2015/09/24 20:05 by arwillis