英文:
why can't Maven find the nd4j .jar file after adding the dependency to pom.xml?
问题
我在IntelliJ IDEA中用OpenJDK-20创建了一个Maven程序,将nd4j的依赖项放在pom.xml文件的dependencies部分,并导入了nd4j.*。但是当我运行程序时,出现了以下错误:
在 central (https://repo.maven.apache.org/maven2) 中找不到 artifact org.nd4j:nd4j:jar:1.0.0-M2.1
我尝试过“使用 -U 运行Maven导入”,这是编译器说可以修复错误的方法,但仍然出现相同的错误。我还访问了repo.maven.apache.org网站,但那里没有nd4j。
英文:
I created a maven program in intellij-idea with openjdk-20, and I put the dependency for nd4j in the dependencies section in pom.xml, and imported nd4j.*, but when I ran the program, it raised this error:
Could not find artifact org.nd4j:nd4j:jar:1.0.0-M2.1 in central (https://repo.maven.apache.org/maven2)
I tried "running the Maven import with -U", which was what the compiler said would fix the error, but it still raised the same error. I also went to the repo.maven.apache.org website, and it didn't have nd4j there.
答案1
得分: 1
我认为您可能在错误的方式下包含了nd4j的依赖项。根据说明,您应该添加Deeplearning4j的依赖项:
<dependencies>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>1.0.0-M2.1</version>
</dependency>
</dependencies>
以及nd4j后端模块的依赖项,例如:
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-M2.1</version>
</dependency>
</dependencies>
您似乎使用了类似以下的内容:
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j</artifactId>
<version>1.0.0-M2.1</version>
</dependency>
</dependencies>
这不起作用,因为该依赖项表示一个父POM而不是一个JAR文件。
我还访问了repo.maven.apache.org网站,那里没有nd4j。
我查看时那里有。但正如我所说,它是一个POM文件,而不是一个JAR文件。
英文:
I think you are trying to include nd4j dependencies the wrong way. If I am reading the instructions correctly, you are supposed to add the Deeplearning4j dependency:
<dependencies>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>1.0.0-M2.1</version>
</dependency>
</dependencies>
and a dependency for one of the nd4j backend modules; e.g.
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-M2.1</version>
</dependency>
</dependencies>
You have apparently used something like this instead:
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j</artifactId>
<version>1.0.0-M2.1</version>
</dependency>
</dependencies>
That doesn't work because that dependency denotes a parent POM not a JAR file.
> I also went to the repo.maven.apache.org website, and it didn't have nd4j there.
It was there when I looked. But as I said, it is a POM file not a JAR file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论