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 Console and many other
plugins:
<project name="Console" default="build" basedir=".">
<property file="../build.properties" />
<property name="build.support" value="../build-support" />
<property name="javadoc.packagenames" value="console.*" />
<property name="plugin.dependencies" value="ErrorList,InfoViewer,ProjectViewer" />
<property name="dist.target" value="dist.complete" />
<property name="compiler.source" value="1.5" />
<property name="compiler.target" value="1.5" />
<import file="${build.support}/plugin-build.xml" />
<selector id="compileFiles">
<and>
<filename name="**/*.java" />
</and>
</selector>
<selector id="extraFiles">
<or>
<filename name="**/actions.xml" />
<filename name="**/dockables.xml" />
<filename name="**/services.xml" />
<filename name="**/*.props" />
<filename name="**/LICENSE" />
<filename name="**/README" />
<filename name="**/*.bsh" />
<filename name="**/*.xml" />
<filename name="**/*.png" />
<filename name="**/*.gif" />
<filename name="**/*.dtd" />
</or>
</selector>
<!-- Add needed plugins to the classpath. -->
<path id="project.class.path">
<pathelement location="${install.dir}/ProjectViewer.jar"/>
<pathelement location="${install.dir}/ErrorList.jar" />
<pathelement location="${install.dir}/InfoViewer.jar" />
</path>
</project>
This build file imports another modular build file, located in another directory. It makes use of a CVS module known as plugins/build-support. You can check this out from the jEdit repository. It contains common build steps for jEdit plugins, and some example properties files which you can adapt for use with your plugin. The file is imported with this line
<import file="${build.support}/plugin-build.xml" />
As long as ${build.support} is set to your local checked-out copy of build-support, the common build rules are imported and the resulting build file is very small and easy to maintain.
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:
the name of the plugin;
the dependencies of the plugin
The extra files that need to be copied into the jar.