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 a
version of build.xml
that could be used by
QuickNotepad:
<project name="QuickNotepad" default="build"> <description> This is an ant build.xml file for building the QuickNotepad plugin for jEdit. </description> <property name="user-doc.xml" value="users-guide.xml" /> <property file="build.properties" /> <property file="../build.properties" /> <property name="build.support" value="../../../build-support" /> <import file="${build.support}/plugin-build.xml" /> </project>
This build file imports another modular build file,
plugin-build.xml
from the build-support
project. It is available as a package you can check out from subversion, or found online in the jEdit's
SVN repository. It contains the common build steps used to build the core jEdit plugins, and some example build.properties.sample
files which you can adapt for use with your development environment.
Customizing this build file for a different plugin will likely only require three changes to build.xml file:
the name of the project
the dependencies of the plugin
The extra files that need to be copied into the jar.
Because this build file and the one of most plugins import a
build.properties
file from the current and the parent
directories, it is possible to build most of jEdit's plugins in a
uniform way by setting the common properties in a single
build.properties
file, placed in the plugin source's
parent directory.
For a full discussion of the Ant
file
format and command syntax, you should consult the Ant
documentation, also available through jEdit's help system if you
installed the Ant Plugin. When editing Ant build files, the XML plugin
gives you completion tips for both elements and
attributes. The Console plugin provides you with an ANT button which you
can bind to keyboard actions. In addition, there are the AntFarm and
Antelope plugins which also proivde you with alternate means to execute
Ant targets through the Console.