Compiling the plugin

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"/>
                                        

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.