Closed robertvazan closed 3 years ago
You can use exclude
clause to filter out jars/platforms you don't need.
Sadly, Maven doesn't allow classifiers in exclusions. The closest workaround I found is below, but this still throws an exception when I try to run it. No idea why.
<dependency>
<groupId>com.github.haifengl</groupId>
<artifactId>smile-mkl</artifactId>
<version>2.6.0</version>
<exclusions>
<exclusion>
<!-- Exclude all native libraries by default. -->
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Explicitly include platform-specific libraries only. -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
<version>2020.3-1.5.4</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
<version>2020.3-1.5.4</version>
<classifier>linux-x86_64-redist</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
<version>2020.3-1.5.4</version>
<classifier>linux-x86</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
<version>2020.3-1.5.4</version>
<classifier>linux-x86-redist</classifier>
</dependency>
I found the last missing dependency. The configuration below works. Still, it was hard to get right. It would be much easier if I could just specify classifier on smile-mkl
and it would pull in what's needed.
<dependency>
<!-- Native libraries needed by smile-math. -->
<groupId>com.github.haifengl</groupId>
<artifactId>smile-mkl</artifactId>
<version>2.6.0</version>
<exclusions>
<exclusion>
<!-- Exclude all native libraries by default. -->
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Explicitly include platform-specific libraries only. -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
<version>2020.3-1.5.4</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
<version>2020.3-1.5.4</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl</artifactId>
<version>2020.3-1.5.4</version>
<classifier>linux-x86_64-redist</classifier>
</dependency>
Thanks for sharing.
Depending on
smile-mkl
is convenient, but it blows my app's JAR to 900MB and stretches build to several minutes. It would be nice to have platform-specific versions of thesmile-mkl
dependency that would be equally convenient to use.