Is it possible to define the target environment for the javacpp-presets (opencv-platform) in the pom.xml file? I know that you're able to set the -Djavacpp.platform
property when executing mvn clean install
. This will activate the correct maven profile and won't add the other system libs to the final jar. But is there a chance to define the platform directly in the pom to avoid the -D argument when executing maven?
Thanks!
Here's the solution I came up with:
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<version>${opencv.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<version>${opencv.version}</version>
<classifier>${os.detected.classifier}</classifier>
</dependency>
The ${os.detected.classifier}
can be set in the pom. I'm using this property with following build extension:
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.1</version>
</extension>
</extensions>
...
This extension (https://github.com/trustin/os-maven-plugin) will detect the os at buildtime and sets the correct classifier through this property.