【发布时间】:2021-02-14 06:23:13
【问题描述】:
我想使用 nd4j-cuda-10.2 中的项目。它有两个操作系统,Linux 和 Windows 的 jar 文件。比使用 windows 系统时如何从 Linux 中排除 jar,反之亦然?。
[Maven 存储库][1] [1]:https://repo1.maven.org/maven2/org/nd4j/nd4j-cuda-10.2/1.0.0-beta7/
由于 jar 文件的重量。我想排除对每个操作系统无用的文件。这可能吗?
我的意思是,我想让 maven 下载文件 "nd4j-cuda-10.2-1.0.0-beta7-linux-ppc64le.jar" 仅在 linux 系统和文件 "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>
我对每个操作系统的配置文件都做了一些工作,因为我发现这是正确的方法,但还不够,我附上了我文件中的一些代码,感谢您的合作,任何贡献都受到高度重视。
【问题讨论】:
-
那么,您的个人资料有什么问题?请注意,您的配置文件与您构建项目的操作系统紧密相关。因此,当您在 Windows 上构建但后来在 Linux 上运行时,这是行不通的。
-
首先感谢您的帮助。当然,我对配置文件没有任何问题,发生的情况是依赖项具有两个操作系统的 JAR 文件,我希望 Maven 只下载一个,即它正在运行的操作系统。这意味着虽然它在 Windows 中,但 maven 也下载了适用于 Linux 的 JAR,这是我想避免的。