Building with Eclipse
It is not necessary to build ClearTK with the following tools as you can do everything from the command line with git and maven clients. However, we use Eclipse along with two plugins, subclipse and m2eclipse, and we encourage you to do the same. Here are the tools that we use:
- Eclipse 3.7 or higher. You can download "Eclipse Classic"
- m2e 1.0.0 or higher.
- update site: http://download.eclipse.org/technology/m2e/releases
- Select the following module: m2e
- EGit 2.0.0 or higher.
- update site: http://download.eclipse.org/egit/updates
- Select the following module: Eclipse EGit
- m2e connectors for the Maven plugins used by ClearTK.
- Go to Window -> Preferences -> Maven -> Discovery -> Open Catalog
- Select the following "Lifecycle Mappings": buildhelper
Checking out and Compiling ClearTK in Eclipse
To check out ClearTK:
- Go to File -> Import... -> Git -> Projects from Git.
- Select URI and then click Next.
- Paste
https://code.google.com/p/cleartk/
as the URI and then click Next. - The master branch will be selected. Click Next.
- The default local storage directory should be fine. Click Next.
- Wait several minutes while the project is cloned.
- Make sure "Import existing projects" is selected and click Next.
- Click Finish.
You should now see the root cleartk
project in your Eclipse workspace and all of its sub-projects. All of the projects should compile except jcasgen-maven-plugin-m2e-tests. Please close this project by right-clicking on it and selecting "Close Project".
Running tests with Eclipse
All ClearTK module have tests defined in their src/main/test directory. To run them: * Right click on the project, then go to Run as -> JUnit Test
It is common for some tests to fail if you do not have your environment set up with all of the prerequisites. To ignore known sets of problematic tests do the following:
* Go to Run -> Run Configurations...
* Select the JUnit run configuration that was created for your project
* On the Arguments tab, add VM arguments such as: -Dcleartk.skipTests=long,bigMem
. For a full list of values that can be passed please consult the DeveloperFAQ here.
Troubleshooting Eclipse Failures to Build
Sometimes you may find that the projects fail to build for no apparent reason. Here are some troubleshooting tips that you can try: * Go to Project -> Clean, select Clean all projects and hit Ok * In the "Package Explorer" view, right click on the cleartk project and select Run As -> Maven Generate Sources * Right click, then go to Refresh to sync up with the local filesystem * Right click, then go to Maven2 -> Update Project Configuration * Right click, then go to Maven2 -> Update Dependencies * Build the project from the command line using Maven.
Sometimes Eclipse will complain that the persisted container within a project references a missing libraries. This is an issue with workspace resolution caused by mismatches between m2(eclipse) and Eclipse. To fix it try: * Right click, Close Project and then right click, Open Project.
(This is assuming that you use the workspace resolution feature of the m2e plugin, which automatically handles inter-project dependencies between the ClearTK sub-projects. If you are not using this feature, or if you don't have all of the ClearTK sub-projects in your Eclipse workspace, you'll have to build manually with maven.)
The following projects are not necessary for developing ClearTK: consistent-versions-plugin, jcasgen-maven-plugin-m2e-tests, uima-jcasgen-maven-plugin. You do not need to import these projects. If you already have and they are causing compile errors, then you can simply close these projects as a way to ignore these errors.
Building on the Command Line
To build ClearTK on the command line, you'll need to have Git and Maven installed. For those old schoolers out there, roughly speaking, Git is a replacement for the CVS version control system, and Maven is a replacement for the Ant build system. There is a wide variety of documentation for Git and Maven online, so here we just summarize the steps you need to get going with ClearTK.
Checking out ClearTK with Git
The ClearTK code is kept in a Git repository. To check out the code run:
git clone https://code.google.com/p/cleartk/
This will create a cleartk
directory in your current directory, and fill it with the contents of the ClearTK code base.
Compiling ClearTK with Maven
When you check out ClearTK from the Git repository you will almost always end up with a snapshot version (e.g. 0.5.0-SNAPSHOT
). You can tell if you have a snapshot version by looking for <version>...-SNAPSHOT</version>
in the pom.xml
in the cleartk
root directory.
Snapshot versions are not deployed to the ClearTK repository, so if you try to compile from a single sub-module (e.g. cleartk-ml
), maven will not be able to find the dependencies (e.g. org.cleartk:cleartk-util:0.7.0-SNAPSHOT
). However, the top level cleartk
module knows about all the snapshot versions of the sub-modules cleartk-ml
, cleartk-util
, etc. Therefore, you can (should) always compile snapshot versions from the top level cleartk
module using:
mvn compile
However, this currently won't work because of bugs in maven. For maven 2, the workaround is:
mvn compile package
For maven 3, the workaround is:
mvn compile test-compile
If for some reason the unit tests are failing then you may find it convenient to modify the command as follows:
mvn compile package -DskipTests
This will allow you to compile everything even if all the tests aren't passing.
Running tests with Maven
You can use the standard mvn test
command from the top level cleartk
module to run the tests. It is common for some tests to fail if you do not have your environment set up with all of the prerequisites. To ignore known sets of problematic tests please consult the DeveloperFAQ here.