简体   繁体   English

如何从 maven 存储库中的依赖项中排除特定的 jar

[英]how to exclude specific jars from a dependency in a maven repository

I want to use the project from nd4j-cuda-10.2.我想使用 nd4j-cuda-10.2 中的项目。 it has jar files for two Operating Systems, Linux and Windows.它有两个操作系统的 jar 文件,Linux 和 Windows。 than How can I exclude the jar from Linux when using a windows system and vice versa?.比使用 Windows 系统时如何从 Linux 中排除 jar,反之亦然?

[Maven Repository][1] [1]: https://repo1.maven.org/maven2/org/nd4j/nd4j-cuda-10.2/1.0.0-beta7/ [Maven 仓库][1] [1]:https://repo1.maven.org/maven2/org/nd4j/nd4j-cuda-10.2/1.0.0-beta7/

due to the weight of the jar files.由于 jar 文件的重量。 I want to exclude files that are not useful to each operating system.我想排除对每个操作系统都没有用的文件。 Is this possible?.这可能吗?。

I mean, I would like maven to download the file " nd4j-cuda-10.2-1.0.0-beta7-linux-ppc64le.jar " only when it be on a linux system and the file " nd4j-cuda-10.2-1.0.0-beta7-windows-x86_64.jar " when on a system windows.我的意思是,我希望 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 上。

Part of pom.xml: 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> 

I have worked a bit on the profiles for each operating system because I have found that it is the correct way to do it but it is not enough, I attach a bit of the code from my file, I appreciate your collaboration, any contribution is highly valued.我已经在每个操作系统的配置文件上做了一些工作,因为我发现这是正确的方法,但这还不够,我附上了我文件中的一些代码,感谢您的合作,任何贡献都是高度重视。

Check if there are separate artifacts/maven dependencies that you could refer to.检查是否有您可以参考的单独工件/Maven 依赖项。 A quick check revealed there is something like https://mvnrepository.com/artifact/org.nd4j/jcuda-windows64 .快速检查发现有类似https://mvnrepository.com/artifact/org.nd4j/jcuda-windows64 的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM