Overview

Building DbUnit is quite simple. You need the following software installed:

Once you have them all, you can build DbUnit by just typing mvn! Anyway, the items below describe every step.

If you wish to work on the latest DbUnit source code, you also may want to install a Subversion client.

Installing the Oracle JDBC driver

DbUnit includes a dependency on the Oracle JDBC driver, which is not available in a public Maven repository. You must download the JAR manually and install it into your local Maven repository.

Note: This dependency is required to compile DbUnit. It is not required to run DbUnit, unless you're actually using Oracle.

  1. Point your web browser to http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html. (Or Google "Oracle JDBC download" if this link breaks.)
  2. Download the Oracle Database 10g Release 2 (10.2.0.4) JDBC Driver for JDK 1.4 and 1.5 (ojdbc14.jar).
  3. Install it into your Maven repository with:
    mvn install:install-file \
    -Dfile=ojdbc14.jar \
    -DgroupId=com.oracle \
    -DartifactId=ojdbc14 \
    -Dversion=10.2.0.4.0 \
    -Dpackaging=jar \
    -DgeneratePom=true
    

    (If you're using Windows, you need to put the whole command on one line, without the backslashes.)

Generating the JAR

  1. Install Java SE SDK, Maven, and the Oracle JDBC Driver.
  2. Download DbUnit code, either current or released source (see Quick Links on left menu)
  3. On the root directory, simply type mvn in the command line. (If you need to clean up the binaries, run mvn clean install instead.) The jar file will be generated in the target directory.

Creating the site

Run mvn site:site in the command line; the site will be available on target/site/index.html. Note that you might get an OutOfMemoryExceptionError; if that happens, you must increase the heap size through the MAVEN_OPTS variable (for instance, on Unix systems, you could run MAVEN_OPTS=-mx512M mvn site:site).

Using an IDE

As DbUnit uses Maven, it is not necessary to store IDE-specific information in the source repository. Instead, these meta-data can be dynamically generate by Maven. For instance, to create an Eclipse project, it is just a matter of typing mvn eclipse:eclipse. See more details on Maven Eclipse Plugin, Mevenide for NetBeans, and Maven IDEA plugin respectively. Further the m2eclipse Plugin might be of interest to you

Contributing patches

  1. Base your work off of master head.
  2. The easier you make it for dbUnit committers to apply your changes, the more likely they will apply your changes.
  3. For problems, your changes should include tests proving the problem exists and proving your changes fix it.
  4. For new features, your changes should include tests proving the feature works. Your tests should prove future changes do not break your feature.
  5. Run Maven using the official profile, i.e., mvn -Pofficial clean install.
  6. Once you finish your modifications, create a patch and attach to the bug or feature request SourceForge tracker item.

Maintenance tasks

The tasks below describe how to maintain DbUnit. Some of these tasks will use ssh to upload files to SourceForge, so it is necessary to setup your environment to allow it (typically using ssh-agent - see more details on SourceForge). Also notice that in 2008 SourceForge changed the way it provides shell access, so you need to create a temporary shell for your user before using ssh (see instructions here.

2009-09-28 TODO: The two links above are dead. This section needs to be revised.

Updating the repository and site

Once new code is committed, it is necessary to update the Maven repository with new snapshots, and also update the site. These 2 tasks can be done with a simple command:

mvn -Pofficial clean source:jar javadoc:jar deploy site:site site:deploy

Releasing

Cutting a release requires the following steps:

  1. Create SCM tag
  2. Generate the artifacts
  3. Update the site
  4. Upload the artifacts into Sonatype OSS repository
  5. Send the announcement email

Fortunately, the steps are automated by Maven. The first 3 steps can be achieved using Maven Release Plugin, as follows:

mvn -Pofficial release:prepare

and then:

mvn -Pofficial release:perform

That last command has created all necessary files for the fourth step. Run the Maven deploy goal to upload the artifacts to the remote repo:

mvn deploy

The final step can also be done by Maven, using the Maven Changes Plugin:

mvn changes:announcement-mail

Note that it is nice to change the release's introduction message first - look for the plugin's introduction parameter in the pom.xml; please change such an element before tagging the release.

Fixing a bug/request

Every time a bug is fixed (or request is implemented), it is necessary to update the src/changes/changes.xml file.