Edit this Page

Add Gurobi Java interface to Maven

Each Gurobi installation contains a jar library that can be used to access Gurobi Optimizer from java code. To use this library from a maven project, you need to first install that jar library into your maven repository.

  1. Locate the jar file (on Windows, it should be in C:\gurobi<version>\win64\lib)
  2. Run the following command (see this guide for details):
mvn install:install-file -Dfile=<PATH TO GUROBI JAR> -DgroupId=com.gurobi -DartifactId=gurobi -Dversion=1.0 -Dpackaging=jar

Example:

mvn install:install-file -Dfile=/opt/gurobi910/linux64/lib/gurobi.jar -DgroupId=com.gurobi -DartifactId=gurobi -Dversion=1.0 -Dpackaging=jar

The Gurobi should be now accessible from Maven projects. To add it to your project, add the following dependency to your project|s pom file:

<dependency>
    <groupId>com.gurobi</groupId>
    <artifactId>gurobi</artifactId>
    <version>1.0</version>
</dependency>