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?
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.
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.7.1'and it worked. - Georgios