saudet commented on issue #17783:
URL: 
https://github.com/apache/incubator-mxnet/issues/17783#issuecomment-707748385


   I've pushed changes that show how to use JavaCPP with maven-publish to my 
fork here:
   https://github.com/saudet/incubator-mxnet/tree/add-javacpp/java
   Running `gradle publish` or something equivalent also deploys an 
`mxnet-platform` artifact that can be used this way:
   
https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies
   
   For example, with this pom.xml file:
   ```xml
   <project>
       <modelVersion>4.0.0</modelVersion>
       <groupId>org.apache</groupId>
       <artifactId>mxnet-sample</artifactId>
       <version>2.0-SNAPSHOT</version>
       <dependencies>
           <dependency>
               <groupId>org.apache</groupId>
               <artifactId>mxnet-platform</artifactId>
               <version>2.0-SNAPSHOT</version>
           </dependency>
       </dependencies>
   </project>
   ```
   We can filter out transitively all artifacts that are not for Linux x86_64 
this way:
   ```
   $ mvn dependency:tree -Djavacpp.platform=linux-x86_64
   [INFO] Scanning for projects...
   [INFO] 
   [INFO] ----------------------< org.apache:mxnet-sample 
>-----------------------
   [INFO] Building mxnet-sample 2.0-SNAPSHOT
   [INFO] --------------------------------[ jar 
]---------------------------------
   [INFO] 
   [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ mxnet-sample ---
   [INFO] org.apache:mxnet-sample:jar:2.0-SNAPSHOT
   [INFO] \- org.apache:mxnet-platform:jar:2.0-SNAPSHOT:compile
   [INFO]    +- org.bytedeco:javacpp-platform:jar:1.5.5-SNAPSHOT:compile
   [INFO]    |  +- org.bytedeco:javacpp:jar:1.5.5-SNAPSHOT:compile
   [INFO]    |  \- org.bytedeco:javacpp:jar:linux-x86_64:1.5.5-SNAPSHOT:compile
   [INFO]    +- org.apache:mxnet:jar:2.0-SNAPSHOT:compile
   [INFO]    \- org.apache:mxnet:jar:linux-x86_64:2.0-SNAPSHOT:compile
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] 
------------------------------------------------------------------------
   [INFO] Total time: 1.360 s
   [INFO] Finished at: 2020-10-13T21:19:51+09:00
   [INFO] 
------------------------------------------------------------------------
   ```
   And we can do the same with the platform plugin of Gradle JavaCPP:
   https://github.com/bytedeco/gradle-javacpp#the-platform-plugin


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to