README.txt revision 65441454220137d37ce3d09bf16ecd7755a4bd13
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOpenGrok - a wicked fast source browser
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye---------------------------------------
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOpenGrok is a fast and usable source code search and cross reference
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeengine, written in Java. It helps you search, cross-reference and navigate
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeyour source tree. It can understand various program file formats and
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeversion control histories like SCCS, RCS, CVS, Subversion and Mercurial.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOpenGrok is the tool used for the OpenSolaris Source Browser.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * Latest Java http://java.sun.com/ (At least 1.5)
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * A servlet container like Tomcat (5.x or later)
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye supporting Servlet 2.4 and JSP 2.0
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * Exuberant Ctags http://ctags.sourceforge.net/
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * Subversion 1.3.0 or later if SVN support is needed
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * Mercurial 0.9.3 or later if Mercurial support is needed
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * JFlex Ant task (If you want to build OpenGrok)
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeSRC_ROOT refers to the directory containing your source tree.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOpenGrok analyzes the source tree and builds a search index along with
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyecross-referenced hypertext versions of the source files. These generated
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyedata files will be stored in DATA_ROOT directory.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOpenGrok setup Step.0 - Setting up the Sources.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye----------------------------------------------
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeSource base must be available locally for OpenGrok to work efficiently. No
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyechanges are required to your source tree. If the code is under source control
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyemanagement (SCM) OpenGrok requires the checked out source tree under SRC_ROOT.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeIt is possible for some SCM systems to use a remote repository (Subversion),
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyebut this is not recommended due to the performance penalty. CVS must have a
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyelocal repository.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeNote that OpenGrok ignores symbolic links.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye---------------------------------------------------
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeUsing command line interface.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye---------------------------------------------------
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeStep.1 - Populate DATA_ROOT Directory
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye=====================================
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOption 1. OpenGrok: There is a sample shell script OpenGrok that is suitable
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyefor using in a cronjob to run regularly. Modify the variables in the script
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeto point appropriate directories, or as the code suggests factor your local
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeconfiguration into a seperate file and simplify future upgrades.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOption 2. opengrok.jar: You can also directly use the Java application. If
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyethe sources are all located in a directory SRC_ROOT and the data and
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyehypertext files generated by OpenGrok are to be stored in DATA_ROOT, run
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye $ java -jar opengrok.jar -s SRC_ROOT -d DATA_ROOT
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeSee opengrok.jar manual below for more details.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeStep.2 - Configure and Deploy source.war Webapp
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye===============================================
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeTo configure the webapp source.war, look into the parameters defined in
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeweb.xml of source.war file and change them (see note1) appropriately.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * HEADER: is the fragment of HTML that will be used to display title or
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye logo of your project
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * SRC_ROOT: the absolute path name of the root directory of your source tree
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * DATA_ROOT: absolute path of the directory where OpenGrok data
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye files are stored
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOptional Step.3 - Path Descriptions
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye-----------------------------------
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeOpenGrok uses path descriptions in various places (For eg. while showing
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyedirectory listings or search results) Example descriptions are in paths.tsv
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyefile. You can list descriptions for directories one per line tab separated
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeformat path tab description. Refer to example 4 below.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeNote 1 - Changing webapp parameters: web.xml is the deployment descriptor
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyefor the web application. It is in a Jar file named source.war, you can
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * Option 1: Unzip the file to TOMCAT/webapps/source/ directory and
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye change the source/WEB-INF/web.xml and other static html files like
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye index.html to customize to your project.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * Option 2: Extract the web.xml file from source.war file
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye edit web.xml and re-package the jar file.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye Then copy the war files to <i>TOMCAT</i>/webapps directory.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye * Option 3: Edit the Context container element for the webapp
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye When invoking OpenGrok to build the index, use -w <webapp> to set the
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye After the index is built, there's a couple different ways to set the
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye Context for the servlet container:
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye - Add the Context inside a Host element in TOMCAT/conf/server.xml
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye <Context path="/<webapp>" docBase="source.war">
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye <Parameter name="DATA_ROOT" value="/path/to/data/root" override="false" />
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye <Parameter name="SRC_ROOT" value="/path/to/src/root" override="false" />
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye <Parameter name="HEADER" value='...' override="false" />
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye - Create a Context file for the webapp
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye This file will be named `<webapp>.xml'.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye For Tomcat, the file will be located at:
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye `TOMCAT/conf/<engine_name>/<hostname>', where <engine_name>
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye is the Engine that is processing requests and <hostname> is a Host
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye associated with that Engine. By default, this path is
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye 'TOMCAT/conf/Catalina/localhost' or 'TOMCAT/conf/Standalone/localhost'.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye This file will contain something like the Context described above.
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye---------------------------------------------------
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeUsing Findbugs
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye---------------------------------------------------
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond NorbyeIf you want to run Findbugs (http://findbugs.sourceforge.net/) on OpenGrok,
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyeyou have to download Findbugs to your machine, and install it where you have
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbyechecked out your OpenGrok source code, under the lib/findbugs directory,
099386ae66a95e7edfed3088abb82bc1e78b6e7cTrond Norbye cd ~/.ant/lib
gtar -xf findbugs-x.y.z.tar.gz
mv findbugs-x.y.z findbugs
[findbugs] Output saved to findbugs/findbugs.html
Now, open findbugs/findbugs.html in a web-browser, and start fixing bugs!
later be parsed, e.g. by Hudson.
opengrok/trunk/lib directory, or ~/.ant/lib.
- libraries - Compile tab. Press the "Add JAR/Folder" and select
The classes inside opengrok.jar should now be instrumented.
If you use opengrok.jar for your own set of tests, you need
coverage data into coverage.ec.
coverage/coverage.html to see how complete your tests are.
you can use checkstyle from http://checkstyle.sourceforge.net/
First you must download checkstyle from http://checkstyle.sourceforge.net/ ,
downloaded, and create a symbolic link to it from ~/.ant/lib/checkstyle,
e.g. like this:
unzip ~/Desktop/pmd-bin-4.2.2.zip
cd ~/.ant/lib/pmd/lib
unzip the .zip file to a directory, and use the pmd.home property
Trond Norbye, norbye.org
Knut Pape, eBriefkasten.de