[英]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.