Building mime4j

Using a Stable Release

Go to the download pages and download the most recent release in your preferred format, either james-mime4j-x.y-src.tar.gz or james-mime4j-x.y-src.zip. Extracting the archived sources will create the directory james-mime4j-x.y/.

Checking Out From Subversion

Issue the following commands in a shell:

git clone git://git.apache.org/james-mime4j.git

Download and Install Maven

You will need to download and install Maven before building the sources. The build has been tested with version 2.0 of Maven so use this or a later version if possible.

One of the main differences between Maven and plain ant is that Maven manages external dependencies for your projects and (at least in theory) you should no longer have to store third-party jar files in your source code tree. It maintains a local repository of versioned libraries and shares them between your Maven projects. If it can't find the necessary files there it will attempt to download them from the main Maven repository at www.ibiblio.org/maven. So to use the Maven build, you need to have a network connection available for the inital download of the project dependencies.

Building the mime4j Jar

Once Maven has been installed, building the project should be as simple as typing

cd james-mime4j-x.y/ (cd james-mime4j/ if sources come from Subversion)
mvn package
from the command line. Maven will automatically run all test cases for you and create the jar file in the target directory.

To install the jar into your local Maven repository run

mvn install

To generate an Eclipse project from the sources run

mvn eclipse:eclipse

NOTE! Mime4j uses JavaCC to generate parsers for header fields. If you're using an old version of maven eclipse pluing mvn eclipse:eclipse could have problems generating proper source folders for the JavaCC generated code. After running mvn eclipse:eclipse you must manually add target/generated-sources/javacc and target/generated-sources/jjtree as source folders under Project -> Properties in Eclipse.

For more information on using Maven, have a look at the Maven web site.