how to use cplex.jar in a maven eclipse project?

1.7k Views Asked by At

I want to use cplex through a maven project. when I use cplex in a non-maven eclipse project, it runs correctly. in non-maven project I had to add the path to native library location of cplex in java build path. but in the maven project, I get errors like "java.lang.NoClassDefFoundError: ilog/concert/IloNumExpr" at runtime. I add dependencies to my cplex.jar in pom :

<dependency>
        <groupId>cplex</groupId>
        <artifactId>cplex</artifactId>
        <version>2.0.1</version>
        <scope>system</scope>
        <systemPath>${basedir}\IBM.ILOG.CPLEX.Optimizer\cplex\lib\cplex.jar</systemPath>
</dependency>

and I test to add native libraries to src/main/resources, and adding resource tab in pom: it doesn't work. I add the native library to class path environment variable: it doesn't work. I copy them in c:/windows/system32: it doesn't work!

can any body help me? what is the solution? :-(

1

There are 1 best solutions below

1
On

Just go through How do I add a jar file to my local Maven repository using Eclipse m2e on Luna Service (4.4.1)?

basically if its a jar not available in maven repository, you can still add it to your local repository and with the required group id, artifact id, and other parameters and use the scope as system while referring to it from you pom file.