Compiling the Plugin

We have already outlined the contents of the user action catalog, the properties file and the documentation file in our earlier discussion. The final step is to compile the source file and build the archive file that will hold the class files and the plugin's other resources.

Publicly released plugins include with their source a makefile in XML format for the Ant utility. The format for this file requires few changes from plugin to plugin. Here is the version of build.xml used by QuickNotepad and many other plugins:

<project name="QuickNotepad" default="dist" basedir=".">

  <property name="jedit.install.dir"  value="../.."/>
  <property name="jar.name"  value="QuickNotepad.jar"/>

  <property name="install.dir"  value=".."/>


  <path id="project.class.path">
    <pathelement location="${jedit.install.dir}/jedit.jar"/>
    <pathelement location="."/>
  </path>


  <target name="compile">
    <javac
      srcdir="."
      deprecation="on"
      includeJavaRuntime="yes"
    >
      <classpath refid="project.class.path"/>
    </javac>
  </target>


  <target name="dist" depends="compile">
    <mkdir dir="${install.dir}"/>
    <jar jarfile="${install.dir}/${jar.name}">
      <fileset dir=".">
        <include name="**/*.class"/>
        <include name="**/*.props"/>
        <include name="**/*.html"/>
        <include name="actions.xml"/>
        <include name="dockables.xml"/>
      </fileset>
    </jar>
  </target>
</project>

For a full discussion of the Ant file format and command syntax, you should consult the Ant documentation site. Modifying this makefile for a different plugin will likely only require three changes: