OpenEye Scientific is now part of Cadence

Using Apache Maven with OpenEye

Using Apache Maven with OpenEye

Maven is a tool that manages Java projects. In addition to other features, it enforces requirements, manages dependencies, and defines artifact creation. This guide explains how to use Maven with OpenEye jars. To get familiar with Maven, please read the 5 Minute Guide and the Getting Started Guide. The rest of this article assumes that Java and Maven are installed and working. It will be helpful to follow the sample HelloMaven project, available at Site Link Broken, while reading this guide.


Creating a Maven Project

To create a new Maven project, the first step is to generate the layout.

mvn archetype:generate -DarchetypeArtifactId="maven-archetype-quickstart" \
-DgroupId="com.user" \
-DartifactId=HelloMaven \
-Dversion="1.0-alpha" \

The command above creates a new project called HelloMaven using a predefined layout maven-archetype-quickstart. Maven has several predefined project layouts. For example, an archetypeArtifactId of “maven-archetype-webapp” will generate a layout for creating servlets. The layout in this example creates a basic jar. groupId defines the package prefix. Here, it is “com.user”, but this should be tailored to your company. For example: com.eyesopen.

Executing the mvn archetype:generate.. command above creates a directory with structure a like this:


Using OpenEye Artifacts

Now that the project has been created, the next step is to tell Maven how to find the OpenEye jars. Two pieces of information are required: the repository server and the dependency definition; this information needs to be added to the pom.xml.

OpenEye Maven Repository

Add the following XML inside a <repositories> block.


OpenEye Maven Dependency

Add the following XML inside a <dependencies> block.


Note that ${oe.platform} is a property and may be defined as one of these values:

  • Windows
  • Linux
  • MacOSX

The examples below define it as Linux.

Finding Available OpenEye Versions

The dependency above uses the 2015.Feb.3 version of OpenEye Jars. Other versions are available and are listed in our Maven hosting site:

Using OpenEye in HelloMaven

After defining the repository and dependency, the next step is to edit and use an OpenEye API. In this example, is modified to display the OEChem version.

package com.user;
import openeye.oechem.*;

public class App {
public static void main(String[] args) {
System.out.println("OEChem Version: " + oechem.OEChemGetRelease());

If everything is set up correctly, compiling should be easy..

Using Maven to Compile and Run

The following command will produce a jar in the target directory in HelloMaven:

cd HelloMaven
mvn package -Doe.platform=Linux

To run the application:

mvn -q exec:java -Doe.platform=Linux -Dexec.mainClass="com.user.App"
OEChem Version: 2.0.3


A Maven project has several benefits. Two stand out from this example. First, the dependencies are explicit and versioned. This creates a standard development environment for all developers working on the project. It also means that repeatable and reliable development environments can be tracked with source code management.

The second benefit is that testing new versions of OpenEye jars is now simple: change the version tag in the dependency definition and recompile.


Maven makes managing dependencies very easy once established. Maven has a mature and rich set of plug-ins for any project task. Maven is also the industry best practice for Java projects. The HelloMaven example and more complex examples can be found on

Having trouble getting started? Contact