To compile and build the plugin, we recommend using the ANT build tool from Apache. It can be found here: http://ant.apache.org. The sample plugin includes a build script for Ant (build.xml) that builds the entire plugin, and creates a Jar file ready for use.
To compile, you need to specify the path to the opinio.jar file, which is located in the WEB-INF/lib folder after installation (or you can simply unzip the opinio.war file). The following lines in the build.xml file needs to be configured:
<property name="opinio.lib.dir" value="../lib"/> <property name="jar.name" value="MyPlugin.jar"/> <property name="jar.dir" value="."/> <property name="deploy.dir" value="opinio/WEB-INF/plugins"/>
opinio.lib.dir: The location of the opinio.jar file.
jar.name: The name of the plugin. If your plugin is called MyPlugin, this file name must be MyPlugin.jar.
jar.dir: The folder where the newly compiled/packaged plugin should be placed.
opinio.lib.dir: If Opinio is installed on your system, then you can run the "dist_copy" target to copy the plugin jar file directly into the Opinio plugins folder, to make it easier to develop the plugin. (an Ant target is a "step" in the build script, and each target can be run independently, or in sequence, depending on how the script is written).
Once these lines in the build.xml script are correctly set up, the plugin should compile. Once compiled, all the files for the plugin is packaged in a jar file. This should be inserted into the opinio/WEB-INF/plugins folder. Opinio will try to load the plugin automatically when starting. If you don't see the plugin in the setup screen after restart, look in the log files for the application server for any errors.
If the plugin is placed in a java package, there are a couple of things to remember. You must place the .java files in folders that equals the package names, so that the compiled .class names are placed in these folders.
Also, in the properties file (.props), you must use the full name of the plugin, like this:
plugin.testpackage.MyPlugin.name=MyPlugin plugin.testpackage.MyPlugin.author=Torgeir Lund plugin.testpackage.MyPlugin.version=1.0 plugin.testpackage.MyPlugin.build=beta 1 plugin.testpackage.MyPlugin.docs=MyPlugin.html plugin.testpackage.MyPlugin.depend.java=1.4 plugin.testpackage.MyPlugin.depend.Opinio.major=4 plugin.testpackage.MyPlugin.depend.Opinio.minor=0
There is sample plugin, NewSurveyLogger, included in the distribution file that is implemented this way.