问题
According to the JavaCPP documentation, if we set the system property: javacpp.platform=linux-x86_64
it should not download the other platforms:
This is from javacpp:
... This downloads binaries for all platforms, but to get binaries for only one platform we can set the javacpp.platform system property (via the -D command line option) to something like android-arm, linux-x86_64, macosx-x86_64, windows-x86_64, etc.
The way to set system properties in Gradle:
Using the -D command-line option, you can pass a system property to the JVM which runs Gradle. The -D option of the gradle command has the same effect as the -D option of the java command.
You can also set system properties in gradle.properties files with the prefix systemProp.
However it downloads all platforms. I have tried different ways to set that property without any difference:
in gradle.properties:
systemProp.javacpp.platform=linux-x86_64
systemProp.gradle.javacpp.platform=linux-x86_64
systemProp.system.javacpp.platform=linux-x86_64
sysProp.javacpp.platform=linux-x86_64
gradlePropertiesProp.javacpp.platform=linux-x86_64
or in build.gradle: (under dependencies)
System.setProperty("javacpp.platform","linux-x86_64")
In build.gradle I have:
compile "org.bytedeco:javacv-platform:1.4.2"
How it is supposed to work?
回答1:
Gradle doesn't support Maven profiles, which we need to get this working. We would need to create a plugin such as sbt-javacpp to implement similar functionality with Gradle.
来源:https://stackoverflow.com/questions/51924302/is-gradle-system-property-in-gradle-properies-not-being-used-javacpp-intellij