share
Stack OverflowInstalling the or-tools library in intellij
[+2] [1] Georgios
[2019-04-17 20:20:49]
[ java intellij-idea or-tools ]
[ https://stackoverflow.com/questions/55735414/installing-the-or-tools-library-in-intellij ]

I am trying to add the google or-tools library within my intellij gradle project.

Unfortunately, I did not find any maven/gradle library to install.

At the moment I just downloaded the java libraries from the following link:

https://developers.google.com/optimization/install/java/windows

and copy pasted the directory in my project.

In the directory the following java libraries are found:

Within my build.gradle file I used the following code:

plugins {
id 'java'
id 'application'
}

group 'ORScheduling'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

applicationDefaultJvmArgs = ["-Djava.library.path=...\\ORSchedulingGradle\\lib"]

repositories {
     mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
 }

The code is running, but I am getting the following error:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil(file:/C:.../ORSchedulingGradle/lib/protobuf.jar) to field 
java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

In addition every time I am making a change in gradle and it automatically updates I have to manually import again the directory with all the downloaded java libraries.

Any idea how to avoid the warnings?

[+1] [2019-04-18 06:30:43] Laurent Perron [ACCEPTED]

The warning is a well know warning from the protobuf library (which is a dependency of or-tools). It is not (yet) an error.

See https://github.com/protocolbuffers/protobuf/issues/3781

It seems to be fixed with protobuf >= 3.7.0.

Next release of or-tools will be build using protobuf 3.7.1.


I just had to add to my build.gradle file within the dependencies the following: compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.7.1' and it worked. - Georgios
Is any time soon coming a maven with the whole libraries? - Georgios
(1) Soon, no. It is on the TODO list. But we need to fix cmake. I would like to do homebrew before... Months away. - Laurent Perron
1