CVS View Plugin#

By RoyPhillips


CVSViewPlugin loads a file from a named CVS repository and displays it in the wiki page


[{CVSViewPlugin cvsview.pserver='scott/tiger@delphi:2401/export/cvsroot'

Lines [{$cvsview.range.lower}] thru [{$cvsview.range.upper}] 
of __[{$cvsview.filename}]__ version [{$cvsview.version}]\\
(Module: {{[{$cvsview.module}]}} path: {{[{$cvsview.path}]}})

This example will attempt to retrieve the current version of the file "/src/java/org/tigris/scarab/actions/" in the module "Scarab" from the CVS repository :

  • located in "/export/cvsroot"
  • on server "delphi" at port 2401
  • using user "scott" and password "tiger" [1]

It will call the ColorCodePlugin to render the file (it will detect the syntax type from the file name), and display only lines 90 thru 100.

[#1] The password is mandatory, otherwise plugin insersion fails and the logs contain Plugin failed while executing: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1

The example also demonstrates the use of variables temporarily injected into the page context (may be used after the plugin invocation only).

In the absence of either colorcode or plugin parameters, the source is rendered using a version of MaxVoelkel's FormatCodePlugin, to get <tt> style and CamelCase support.

Rendering with other plugins#

To use another plugin to the render the file, such as Java2HtmlPlugin, use the cvsview.plugin parameter to name the plugin, and pass its parameters prefixed with the plugin name:

[{CVSViewPlugin cvsview.pserver='scott/tiger@delphi:2401/export/cvsroot'
                cvsview.title='!FILENAME\nPATH \'\'Version\'\': VERSION'

This example also demonstrates the cvsview.title facility, which precedes the file inclusion with the specified JSPWiki markup, substituting the strings FILENAME, VERSION, MODULE, PATH with the values returned from CVS.


cvsview.pserverConnection string to CVS via pserver
cvsview.moduleName of module in CVS repository
cvsview.filepathFull path and filename to be retrieved
cvsview.colorcode'true' if the ColorCode plugin should be used
cvsview.titleJSPWiki markup for title or heading
cvsview.pluginName of plugin to use to render source
  1. Question: how about :ext: support?


As the plugin requires both username and password for the cvs repository to be specified in a publicly-editable page, the plugin should be used for anonymous-accessible repositories, or internal intranets. This plugin only allows file viewing, but the user ID and password can be used in other tools, so it's best to use an Id that isn't in the writers file. Having said that, pserver passwords aren't exactly the most secure...


  • Specify required version, ID, etc. for resource
  • Other CVS protocols than pserver
  • Safer authentication (use Wiki ID/password? Use certs?)
  • Wrap text returned in specified plugin (e.g., Java2HtmlPlugin) (done, use: cvsview.plugin='name')
  • Name method to extract from source or line number range (done for range)


If the cvsview.colorcode='true' parameter setting is used, the Color Code plugin should be installed, likewise for cvsview.java2html.


  • Download the distribution jar(info) into the local JSPWiki/WEB-INF/lib directory.
  • Either invoke with full package name, or add to JSPWiki/WEB-INF/ plugin search path:
jspwiki.plugin.searchPath = ...,lu.intrasoft.jspwiki.plugin, ...


  • Unpack the source jar(info) into some convenient directory
  • Edit the file to set the local webserver path
    • E.g., webserver.dir=C:/Program Files/Apache Software Foundation/Tomcat 5.5
  • Run the ant task deploy


CVSViewPlugin.javaA WikiPlugin wrapper around CVSFile
CVSFile.javaNon-plugin specific code to check-out a single named file from CVS
CVSItem.javaRepresentation of a CVS entry, incudes filename, version, size and contents
CVSPassword.javaCVS's trivial password algorithm

<< Back to Contributed Plugins

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
cvsfile-plugin.jar 0.0 kB 2 04-Oct-2006 13:15 Sothach
cvsview-eg1.bmp 494.8 kB 2 04-Oct-2006 13:14 Sothach
cvsview-plugin-src.jar 8.3 kB 4 04-Oct-2006 14:30 Sothach
cvsview-plugin.jar 10.6 kB 4 04-Oct-2006 14:30 Sothach
« This page (revision-74) was last changed on 10-Oct-2007 07:13 by MurrayAltheim