javamavenmaven-2dl4jjavacpp

Maven Build for specific OS and Architecture | abiFilters equivalent for maven


Maven is generating a JAR that is too big (~1.1GB) for a simple 20 line function, possibly because it includes dependences that are not necessary for my run-time environments (macosx-x86_64 and linux-arm64). How do I generate a JAR using maven for specific architectures?


Solution

  • Dl4j uses javacpp which integrates various native libraries allowing us to use c++ code from java.

    It also includes the ability to package dependencies as part of jar files using classifiers. Our dependency declarations use a -platform suffix which includes all dependencies. We do this for ease of use.

    Later when users are ready to deploy, they can cut things down by specifying -Djavacpp.platform=$YOUR_TARGET_PLATFORM like linux-x86_64, windows-x86_64

    or android : android-arm64, android-x86_64 - we cover that more in our documentation: https://deeplearning4j.konduit.ai/multi-project/how-to-guides/developer-docs/javacpp#javacpp-platform-specific-profiles