Skip to content

Building LOCKSS Plugins

Tom Lipkis edited this page Nov 1, 2022 · 3 revisions

Building LOCKSS Plugins

Plugins are normally built and packaged using a framework written in Maven. To create a project in which to store and build plugins, use the lockss-plugins-archetype.

  • Change to the directory you want to be the parent of your new plugins project
  • Generate a new Maven project with
    mvn archetype:generate -DarchetypeGroupId=org.lockss -DarchetypeArtifactId=lockss-plugins-archetype -DarchetypeVersion=1.2.0-SNAPSHOT
    (Or run bin/create_plugins_project in the laaws-dev-scripts project.)
    Answer the questions:
    • Define value for property 'groupId': Enter the toplevel identifier for your group/institution, e.g., org.institution.
    • Define value for property 'artifactId': Enter a single-word name for this (set of) plugin(s), e.g., OjsPlugins.
    • Define value for property 'version' 1.0-SNAPSHOT: Enter a version number of accept the default.
    • Define value for property 'package': Either accept the default (the groupId) or specify a package below that, e.g., org.institution.library.

This will generate a typical Maven project tree under artifactId/, with a sample plugin in src/main/java/package. Replace the sample plugin and java classes with your own.

(Because most of our plugins have Java components, we typically put the plugin .xml file in src/main/java together with the .java files, but the .xml files can go in src/main/resources if you wish.)

To build and package the plugin(s) in the project, invoke mvn package with one of the following options. In order to be loaded into LOCKSS, plugins must be signed:

  • runcluster has a builtin insecure (non-secret) key intended for use during development. To build a plugin for use with runcluster, run mvn package -Ptesting
  • In order to deploy a plugin to a production environment it must be signed with a private key. Run mvn package -Dkeystore.file=file -Dkeystore.alias=alias. You will be prompted for the keystore password.

Both invocations will produce, in target/pluginjars, a signed jar for each plugin in the project. Instructions for using these jars with runcluster are in the runcluster README. To deploy plugin jars to production they should be uploaded to the plugin registry, details of which depend on the installation.