Building with Maven 2

Maven is, just like ant, a build tool. However, where you have to tell ant what it needs to do and how, you only have to tell Maven what you need, if you adhere to the Maven standards.

In order to use Maven to build JDBC Logger, you need to have Maven 2 installed. This should not be any more difficult than installing ant. We've included a best practice installation and configuration for Maven.

Installing Maven

First you need to download the latest Maven 2, let's say maven-2.0.7; make sure you download the binary archive (maven-2.0.7-bin.zip).

Installing Maven should be easy, unzip the file to any directory you like, let's say:

C:\maven-2.0.7

Next you need to do 2 things:

  • add an environment variable MAVEN_HOME which points to the install directory of Maven, i.e. C:\maven-2.0.7
  • add %MAVEN_HOME%\bin to your path (using the variable you can switch more easily when a new version arrives)

Using Maven

Maven defines several goals, for creating and building your application. A goal is similar to an Ant-task. For instance: to compile the java sources one could do:

mvn compile

Also, a goal can depend on other goals: the package goal depends on running the unit tests and compilation of the code.

See the Maven site for more information on the different goals and plugins that are available.

Before Building JDBC Logger

Before you can go on and build JDBC Logger you have to solve any existing dependency problems. These are usually caused by the fact that non open source packages can't be added to maven's official repositories.

Right now JDBC Logger has just one such dependency problem and that is the oracle JDBC driver. You will have to download and install it in your local repository:

  • go to the Oracle Database 10g Release 2 page and download ojdbc14.jar file.
  • in the folder where you downloaded the file run the following in command line:
    mvn install:install-file -Dfile=./ojdbc14.jar -DgroupId=ojdbc -DartifactId=ojdbc -Dversion=14 -Dpackaging=jar
    

This will add the jar to your local repository with the groupId, artifactId and version required by JDBC Logger.

Building JDBC Logger

Building JDBC Logger merely consist of running Maven:

mvn install

You now have successfully built JDBC Logger. The files are in your private repository.