在 intellij 中安装 or-tools 库

Installing the or-tools library in intellij

我正在尝试在我的 intellij gradle 项目中添加 google or-tools 库。

很遗憾,我没有找到要安装的 maven/gradle 库。

目前我刚刚从以下link下载了java库:

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

并复制粘贴我项目中的目录。

在目录中找到以下 java 个库:

在我的 build.gradle 文件中,我使用了以下代码:

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'
 }

代码是 运行,但我收到以下 错误

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

此外,每次我在 gradle 中进行更改并且它会自动更新时,我必须再次手动导入包含所有下载的 java 库的目录。

知道如何避免警告吗?

该警告是来自 protobuf 库(它是 or-tools 的依赖项)的众所周知的警告。这不是(还)是一个错误。

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

protobuf >= 3.7.0 似乎修复了。

or-tools 的下一个版本将使用 protobuf 3.7.1 构建。