Please see for up-to-date documentation.

CDM Library Developers Guide


Regarding the installation of the development tools please refer to DeveloperApplications.

Conventions regarding api method naming etc. are found in the CdmLibraryConventions.

Maven repository

See also : DeveloperApplications#Maven

To integrate the cdmlibray into your personal Maven project pelase add our Maven repository to your POM:

To use the cdm service package add the following dependency to you POM (adapt the right version number !!)


To create a project site use mvn site:site. Due to the number of dependencies you will have to increase the available memory by setting the MAVEN_OPTS parameter to

   SET MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=512m

See also: DeveloperFaq#Addingabundletoamavenrepository

Using maven

For some unclear reasons we encountered problems using maven in combination with aspectj.

We did not yet resolve this problem but at least found a work-around:

  1. run "mvn clean" (probably not really needed)

  2. open eclipse IDE

  3. make sure that cdmlib-model is converted to an AspcetJ project (see Eclipse setup for detailed information) - sometimes it helps if you first remove AspectJ and then convert it again.

  4. run Project-clean

  5. run "mvn install"

This seems to work at least on our computers as eclipse better compiles aspectj then maven does.

So please first try the above if you encounter any compilation problems

If it still does not work please try to install the newest eclipse aspectj plugin (for installation instructions see below)

If it still does not work please let us know

Eclipse setup

To use the entire cdmlibrary with Eclipse, you need some plugins and to follow this installation guide:

  • install maven 2.0.x commandline tools locally ( Follow the instruction to install maven on your local machine.

  • install subclipse 1.6.x in eclipse if not yet installed (Update Site:

  • make sure Java JDK >= 1.6 is installed (JRE is not enough) and JAVA_HOME is set to JDK path

  • checkout cdmlib and create eclipse artifacts (using e.g. tortoiseSVN):

$ svn co .

  • make sure maven has run at least one time (to create the .m2 folder). If unsure how to do this, run mvn install in the new checked out folder ../cdmlib/cmlib-commons

  • Set in Eclipse preferences (not project properties) M2_REPO java class variable (menue: java-buildPath-Classpath), pointing to your local repository.

    • In OSX for example /Users/USERNAME/.m2/repository
    • In WinXP for example C:\Documents and Settings\USERNAME.m2\repository
  • setup new eclipse workspace (where ever you want but using the cdmlib folder may be comfortable

  • run the following commands in your cdmlib folder

$ mvn install

to compile and install the cdmlib packages in your local repository.

$ mvn eclipse:eclipse

to let maven create project dependencies and Eclipse metafiles (.project s.o.)

  • create the java projects:

    • In Eclipse open the Import Wizard: File->Import->General->Existing Projects into Workspace.
    • Choose "Select root directory". Click "Browse" and navigate to your cdmlib folder (should open by default) and confirm the file dialog.
    • The projects should now show in the Import Wizard window. Select the projects you want wo work on and hit OK.
  • Install AspectJ compiler , make sure you add the /lib/aspectjrt.jar to your class path and /lib/ to your path

  • Install AspectJ Development Tools (AJDT) - Plugin (for eclipse) (Update-Site: where xx depends on your eclipse installation: xx=35 for eclipse 3.5 and xx=36 for eclipse 3.6

  • Referesh cdmlib-model project within eclipse

  • Convert the cdmlib-model to AspectJ (right mouse click on project -> AspectJ Tools -> ...).

  • It is also recommended to use the EclipseCodeTemplate

Install issues

In case you run into trouble try one of the following

  • It wasn't clear to me (PC) from the above that at some point, the following must be executed in the "cdmlib" directory. I did this after all the above steps were completed, and the build was successful.

$ mvn install

$ mvn eclipse:eclipse

How to create a new cdmlib version

The following steps have to be followed when increasing the cdmlib version to make all applications running

  • update the cdmlib version number in parent.pom and all module poms (cdmlib-common.pom, cdmlib.model.pom, ...)

  • update the

Spring applications with cdmlib

In your own applicationContext.xml you can simply import the cdm service spring beans from the library. In addition it also needs a datasource bean and a hibernateProperties bean specific for that datasource. The CDM Library comes with an embedded hypersonic database that is super easy to use. All you need to do is to import that hsql specific spring configuration like this:


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <import resource="classpath:/eu/etaxonomy/cdm/services.xml" />
    <import resource="classpath:/eu/etaxonomy/cdm/hsql-datasource.xml" />


In case you want to define the datasource within your own applicationContext you can surely do so. For a typical mysql database it looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <import resource="classpath:/eu/etaxonomy/cdm/services.xml" />

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://"/>
        <property name="username" value="cdm_user"/>
        <property name="password" value="why_do_i_need_this"/>

    <bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="properties">
                <prop key="">validate</prop>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.format_sql">false</prop>



Spring 2.0 Framework

We use the Spring 2.0 framework to develop the library and keep the coupling of components low.

Domain Models

Property Change

Useful Patterns

Aspect Oriented Programming

We use AspectJ to implement the change property crosscutting concern:

Updated by Katja Luther almost 2 years ago · 30 revisions