Task:

Create a new Netbeans wrapper module for JavaProject that rebuilds itself when it should. Using this increases change-build-run developement cycle.

What is wrong with normal Netbeans wizzard?

Nothing, unless you change the project that created the encapsulated jar in the first place, which we do a lot. Example: SposhCore JavaProject is encapsulated in PogamutNbUTSposhCore. When you change something in SposhCore and compile it, you have to replace the jar that is stored in PogamutNbUTSposhCore.

Howto

We'll call java project JP and wrapper module WM.

Create a WP from JP using NB wizzard.

Alter WM build.xml

Add following build.xml after <import file=“nbproject/build-impl.xml”/> and stuff

  <target name="release">
      <echo message="Building ${pogamutUT2004.dir}"/>
      <ant dir="${pogamutUT2004.dir}"
       target="jar" inheritall="false" inheritrefs="false"/>
      <echo message="Done building ${pogamutUT2004.dir}"/>
      <copy todir="${cluster}/modules/ext"
        file="${pogamutUT2004.jar}"/>
  </target>
  <target name="clean" depends="projectized-common.clean">
      <echo message="Cleaning ${pogamutUT2004.dir}"/>
      <ant dir="${pogamutUT2004.dir}"
       target="clean" inheritall="false" inheritrefs="false"/>
      <echo message="Done cleaning ${pogamutUT2004.dir}"/>
  </target>

Remember to change the paths and variables to suit your project. *

Alter WM Project.xml

* To WP Project.xml add

          <class-path-extension>
              <runtime-relative-path>ext/JP.jar</runtime-relative-path>
              <binary-origin>../path/to/project/dist/JP.jar</binary-origin>
          </class-path-extension>

to /project/configuration/data