user1244932
user1244932

Reputation: 8082

gradle + idea: can not resolve systemProperty in build.gradle

To run tests with jni helper library I add such code into build.gradle:

def jniLibDir = "xxx"
tasks.withType(Test) {
    systemProperty "java.library.path", jniLibDir
}

and ./gradlew build works without problems, but idea reports error:

Can not resolve symbol systemProperty

and if run test under idea it throw java.lang.UnsatisfiedLinkError exception.

How help to idea to understand where take my dll with jni code?

Upvotes: 2

Views: 705

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 401897

Related issue:

  • IDEA-160675 Making Gradle system properties available to IDEA's test runner

You will need to add -Djava.library.path=/path/to/dir/with/native/libs into IntelliJ IDEA Run/Debug configuration VM Options field. This can be changed for the configuration under Defaults node so that it's added automatically to all the new tests you run from the right click menu.

Upvotes: 1

Related Questions