Wednesday April 15, 2009
Using Subversion with OpenGrok
In my previous blog entry Using CVS with OpenGrok I showed the steps needed to configure OpenGrok with CVS, and in this entry I will extend that example to include a project using Subversion.
The first thing we need to do is to install a Subversion client and check out the source code. I don't use Subversion for any of my projects, but Knut Anders is working on Apache Derby (hosted in a Subversion repository) so lets use that in this example.
trond@opensolaris> pfexec pkg install SUNWsvn trond@opensolaris> cd /var/opengrok/source trond@opensolaris> svn co https://svn.apache.org/repos/asf/db/derby/code/trunk derby
If we use the browser to navigate to http://localhost:8080/source/xref you will see a new directory named derby. The history links and selection box selection box in http://localhost:8080/source/ does however not work for Derby yet, so let's go ahead and update the configuration:
trond@opensolaris> cd /var/opengrok
trond@opensolaris> java -jar /var/opengrok/bin/opengrok.jar -c /var/opengrok/bin/ctags \
-v -s /var/opengrok/source -d /var/opengrok/data -S -P \
-p /opengrok -n -r on -W /etc/opengrok/configuration.xml
(run look at the man page for a description of the different options).
With the new configuration in place, we can start the index generation:
trond@opensolaris> cd /var/opengrok trond@opensolaris> java -Xmx2g -jar /var/opengrok/bin/opengrok.jar -R /etc/opengrok/configuration.xml -H
With the new index database in place it is time to update the web application to use the new configuration:
trond@opensolaris> java -Xmx2g -jar /var/opengrok/bin/opengrok.jar -R /etc/opengrok/configuration.xml -n\
-U localhost:2424
Or you could just restart the Tomcat web server:
trond@opensolaris> svcadm restart tomcat6
If you navigate to http://localhost:8080/source/history/derby/README you should get the history for the README file and the annotate link should be available. Subversion supports changesets so you should be able to request history for directories, but the directory information is not cached so this is a potentially slow operation (if you have remote SCM repositories).
Posted at 03:45AM Apr 15, 2009 by trond in OpenGrok | Comments[3]