[英]How to exclude specific class from a Maven dependency ( Jar dependency) at runtime
[英]how to exclude specific jars from a dependency in a maven repository
我想使用 nd4j-cuda-10.2 中的項目。 它有兩個操作系統的 jar 文件,Linux 和 Windows。 比使用 Windows 系統時如何從 Linux 中排除 jar,反之亦然?
[Maven 倉庫][1] [1]:https://repo1.maven.org/maven2/org/nd4j/nd4j-cuda-10.2/1.0.0-beta7/
由於 jar 文件的重量。 我想排除對每個操作系統都沒有用的文件。 這可能嗎?。
我的意思是,我希望 maven 僅在 linux 系統上下載文件“ nd4j-cuda-10.2-1.0.0-beta7-linux-ppc64le.jar ”並且文件“ nd4j-cuda-10.2-1.0”。 0-beta7-windows-x86_64.jar "在系統 windows 上。
pom.xml 的一部分:
<profile>
<id>Windows_Profile</id>
<activation>
<os>
<name>windows 10</name>
<family>Windows</family>
<arch>amd64</arch>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-cuda-10.2-platform</artifactId>
<version>${nd4j.version}</version>
<classifier></classifier>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-cuda-10.2</artifactId>
<version>1.0.0-beta7</version>
<exclusions>
<exclusion>
<groupId></groupId>
<artifactId></artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
我已經在每個操作系統的配置文件上做了一些工作,因為我發現這是正確的方法,但這還不夠,我附上了我文件中的一些代碼,感謝您的合作,任何貢獻都是高度重視。
檢查是否有您可以參考的單獨工件/Maven 依賴項。 快速檢查發現有類似https://mvnrepository.com/artifact/org.nd4j/jcuda-windows64 的東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.