Apache UIMA
Source Code
UIMA project logo

Search the site

 Apache UIMA Source Code

 Source Code Repository

Apache UIMA uses Subversion to manage its source code. If you're new to Subversion, you can check out the online book about Subversion. Note that we are currently using Subversion 1.1.x (there are separate versions of the book covering 1.0 and 1.1).

The code for UIMA is stored in several sections:

  1. http://svn.apache.org/repos/asf/incubator/uima/uimaj - the Java code for base UIMA
  2. http://svn.apache.org/repos/asf/incubator/uima/uima-as - the Asynchronous Scaleout add-on for base UIMA
  3. http://svn.apache.org/repos/asf/incubator/uima/sandbox - a collection of add-ons for UIMA including annotators
  4. http://svn.apache.org/repos/asf/incubator/uima/uimacpp - the C++ framework supporting Annotators written in C++

Each of these have subdirectories: trunk - for the latest, tags - for preserved copies of releases, and (sometimes) branches - for special development efforts.

To receive notice of commits to the repository subscribe to uima-commits@incubator.apache.org by sending email to uima-commits-subscribe@incubator.apache.org.

Web Access to Subversion

If you just want to browse the source code, you can use the ViewCVS web interface to Subversion. This is current at all times.

 Checking Out Code Using Subversion

Anyone can check code out of Subversion. Username and password are only needed to update the Subversion repository; only UIMA committers can do that. If you are a committer, are working from behind a firewall, or are connected to the internet through a proxy server, please see the sections below for more information.

Anonymous check out from Subversion

Use a command like:

% svn checkout http://svn.apache.org/repos/asf/incubator/uima/uimaj/trunk

Once you have Apache UIMA checked out you can update your working copy of the checked-out sources, to pick up any changes committed since you checked things out, by executing the following command from within the UIMA directory.

% svn update

Access from behind a firewall

For those users who are behind a corporate firewall which is blocking http access to the Subversion repository, you can try to access it via HTTPS:

% svn checkout \
https://svn.apache.org/repos/asf/incubator/uima/uimaj/trunk

Access through a proxy

The Subversion client can go through a proxy, if you configure it to do so. First, edit your "servers" configuration file to indicate which proxy to use. The files location depends on your operating system. On Linux or Unix it is located in the directory "~/.subversion". On Windows it is in "%APPDATA%\Subversion". (Try "echo %APPDATA%", note this is a hidden directory.)

There are comments in the file explaining what to do. If you don't have that file, get the latest Subversion client and run any command; this will cause the configuration directory and template files to be created.

Example : Edit the 'servers' file and add something like :

[global]
http-proxy-host = your.proxy.name
http-proxy-port = 3128

Committer access

Everyone can access the Apache UIMA Subversion repository via HTTPS. Apache UIMA Committers must checkout the Subversion repository via HTTPS, in order to be able to check in changes.

% svn checkout \
https://svn.apache.org/repos/asf/incubator/uima/uimaj/trunk

Checking Out Code using Eclipse

To access the SVN repository from Eclipse, you will need to install the Subclipse plugin from the update site http://subclipse.tigris.org/update_1.0.x. You can then check out code as follows:

  1. Bring up the "SVN Repositories" View (from Window -> Show View -> Other)
  2. Right click in the SVN Repositories View and select New -> Repository Location.
  3. Enter the URL http://svn.apache.org/repos/asf/incubator/uima/uimaj/trunk (or https://...)
  4. Shift-click to select all of the projects, right click and choose "Checkout..."
  5. Select "Check out into the workspace as projects" and click "Finish"
This will check out all of the code, but as "plain" (that is, not Java) projects. To convert the projects to Java projects, you need to do mvn install eclipse:eclipse in the uimaj project directory, the uimaj-as project directory, and the SandboxDistr project directory, for the base UIMA, UIMA-AS, and the Sandbox Distribution, depending on which ones you checked out. See below for more details on these steps.

 Submitting Code Changes

Submitting a patch

If you make changes to Apache UIMA, and would like to contribute this to the project, you should open a JIRA issue and discuss the changes with the developer community. If there is agreement, create a patch and attach it to the JIRA issue.

To create a patch, use the Eclipse Team -> Create Patch command select the project in the Package Explorer, right click it to find the Team menu in the context menu). Or, use the command line and execute the svn diff command. This creates a patch that can easily be uploaded to a JIRA issue. A good name for the patch includes the JIRA issue name, e.g. UIMA-104.patch. If there are several patches for the same JIRA issue, you might include a short identifying description, or your initials, e.g. UIMA-104.clr.patch

% svn diff > UIMA-104.clr.patch

Committing changes to subversion

To commit changes to the subversion repository, you must be an Apache UIMA committer. See get involved for information on how to become a committer and how to set up your password once you become a committer.

Once your password is set, you can commit from Eclipse using the Team -> commit context menu. You can do this on an individual file, a set of files or directories (multi-select), or on whole project(s). You can also commit from the command line like this:

$> svn commit --username your-username \
 Authentication realm: <https://svn.apache.org:443> \
 ASF Committers Password for 'your-username': your-password

You can also pass your password on the command line directly, but this is a security problem on multiuser unix computers (the command line arguments are available via the ps command). Here is the command if you are Windows or a single user unix computer:

$> svn commit --username your-username \
  --password your-password

Remember to replace 'your-username' and 'your-password' with your actual username and password on svn.apache.org.

Please also add to your commit statement an appropriate message that explains the changes you did. You can add a message when adding --message to your commit statement:

$> svn commit --username your-username \
  --password your-password --message your-message

Please always enter the JIRA issue key or keys (if more than one issue) and optionally, the JIRA issue link to the commit message. The issue key (e.g., UIMA-555) is important so that the JIRA SVN plugin can detect the changes automatically. Only specifying the issue link does not work correctly, for details please see the JIRA issue http://jira.atlassian.com/browse/SVN-37.

 Building UIMA from Source

Apache UIMA uses Maven 2 to do builds. Release 2.2.x of Maven, or later, is required. Download Maven from http://maven.apache.org and add <maven-home>/bin to your path.

The source can be obtain in two ways:

  1. You can checkout the source from SVN, from trunk, or a particular tagged release, or
  2. you can use the source version of the release artifact you download from the download page.

If you want to build the DocBooks from the Docbook sources, you need to set up your DocBook tooling by obtaining the needed parts, either from the UIMA SVN or from other places on the web (see below). Note that the PDF files only build correctly on a Windows platform (due to font issues).

Building from the command line

To build base UIMA from the command line,

$> cd uimaj
$> mvn install

Builds for uima-as and the sandbox projects work similarly, however the build process requires that base UIMA be in the same containing directory. If you check out these other projects from SVN, you will need to copy the projects from these checkouts into the same base directory as base UIMA, so all the projects are siblings within that directory. The same is true for building from the source distribution.

Once the directory is set up, do:

$> cd uimaj-as
$> mvn install
      or 
$> cd Sandbox
$> mvn install

This should build all of the jars and run the unit tests. Each jar will be located under the target subdirectory of its project, for example uimaj-core/target/uima-core.jar.

If you want to build just one of the "projects", and not the whole thing, cd to the project you want to build, and run mvn install there.

Building from Eclipse

  1. First, follow all the steps under "Building from the command line, above." You will only need to do this once.

  2. (Optional) If you want a new workspace for the maven work, start Eclipse and create a new workspace.

  3. In a command window, execute

    mvn -Declipse.workspace=<eclipse workspace dir> \
        eclipse:add-maven-repo
    This adds a maven repository to your machine (On Windows, under documents & settings / .m2 / repository), and sets up an Eclipse Java Build Path variable to reference it.

  4. Use Eclipse's SVN Repository explorer to checkout all the projects under uimaj/trunk. Tell it to create new Java projects for these.

  5. cd uimaj to switch to the Eclipse workspace project for uimaj (it has the top level POM), and run the command:

    mvn eclipse:eclipse

    If you haven't run the "install" using maven (because you forgot to follow all the steps under "Building from the command line, above"), you should do the command mvn install eclipse:eclipse. The "install" argument builds UIMA using maven, before the eclipse:eclipse goal is run. This is needed for the Eclipse Plugins that are part of UIMA - these projects have their "MANIFEST.MF" file built by maven from the information in the maven POMs. This step may take a few minutes because the "install" lifecycle includes running the unit tests.

  6. Return to Eclipse, and if needed, select all the projects and push F5 to "refresh" them (because the previous command changed the .project and .classpath files). You can set your workspace to automatically refresh - in which case skip this step.

  7. The projects should now compile without errors, and have build paths which reference copies of things in your local maven repository.

  8. You can run the unit tests in Eclipse by right-clicking on a folder (for example uimaj-core/src/test/java) and selecting Run As -> JUnit Test. This will run all tests under that folder.

What to do if the tests fail

(Note: this kludgy procedure needs improvement)

If you get a failure messsage, the details of the failures are logged in a file for each project which has a failue, in the folder target/surefire-reports. In Eclipse, you can use the Search facility to search Files in the workspace of type "*.txt" for the string "<<< FAILURE!" to locate all the failure messages.

If not using Eclipse, you can use grep to accomplish the same thing.

You can bypass the tests by doing mvn -Dmaven.test.skip install. But please do this only after you've run without it and have verified the tests results.

How to build the full Apache UIMA distribution

Distributions include zip/tar packages of source or binaries. Please refer to this page: Building a distribution for details on how to do this.

To build a distribution, first do a build as described in "Building from the command line". Then (assuming you set up the Eclipse path using one of the first 2 methods, execute the following:

cd ../uimaj-distr
mvn install

This will build the javadocs and the manual (using docbooks, as described below), will create the Eclipse update site for the Eclipse plugins, and will create .zip and .tar.gz archives of the full UIMA distribution in the uimaj-distr/target directory.

Similarly, for building the uima-as add-on distribution, first be sure you've built the projects themselves (see above) and then do:

cd ..\uima-as-distr
mvn install

Similarly, for building the sandbox distribution, first be sure you've built the projects themselves (see above) and then do:

cd annotator-package
mvn install

This maven command will create the assemblies in the target directory, and will also run the Release Audit Tool (RAT) on the result.

  • To skip running RAT, use the command mvn package.

Building uima-docbooks

The UIMA Source distribution includes the uima-docbook-tool project, which is the tooling needed to build the Docbooks; the actual Docbook sources are in the uima-docbooks project, in the src directory. The DocBook tooling requires several components that are not included in the source distribution, but instead are automatically downloaded from the internet the first time you run the tools; you will be asked to accept the licenses for these components. Please read the README.FIRST and README files in the uima-docbook directory for important information about setting up the tooling. In particular, in order to get the images to be rendered in the PDF output, you must obtain the "Java Advanced Imaging" library from Sun.

Note that the uima-docbooks project is not built using Maven; it is built by an ant script. If you want to build the documentation without building the entire UIMA distribution, cd to the uima-docbooks directory, and run ant. This will build all 4 books into the uima-docbooks/target directory.

Note that each book is actually built twice - the first build only runs the transforms to get the links established and setup of cross reference database table. The second outputs the html and pdf files, using the cross reference database table just created.

Creating A4-size PDF documentation

If you don't live in the US, you may wish to create your PDF documentation in a different format, e.g., A4. To do this, edit the file uima-docbook-tool/properties/default.docbook.properties. It contains a line

paper.type = Letter

Change this setting to A4 and rebuild the documentation. Note: if you've previously built the documentation, you need to run ant clean first, as the build doesn't pick up on this change automatically.