我有一个带有依赖项的 Maven 项目 (datanucleus-db4o)。此依赖项本身依赖于 db4o (db4o:db4o:jar:7.12.126.14142-all-java5)。
现在 Maven 说:
09.09.10 19:43:09 MESZ: Missing artifact db4o:db4o:jar:7.12.126.14142-all-java5:compile
我是 Maven 新手。 datanucleus-db4o 是否使用特定版本号定义了自己的依赖项?这是个好办法吗? m2eclipse无法下载。我下载了较新版本的 db4o 并将其添加到类路径中。 Maven 一直在写关于缺失工件的文章。
此外,当我启动应用程序时,我遇到了 NoClassDefFound 错误。这引出了另一个问题:
我做错了什么吗?
提前致谢。
这是 pom.xml 的相关部分...
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>2.2.0-m1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-db4o</artifactId>
<version>2.1.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
这是 pom.xml 的相关部分
<dependency>
<groupId>db4o</groupId>
<artifactId>db4o</artifactId>
<version>7.12.126.14142-all-java5</version>
</dependency>
最佳答案
Is it right that datanucleus-db4o defines its own dependency with a specific version number? Is this a good way?
我不确定我是否理解了这个问题...无论如何,datanucleus-db4o 工件的 db4o:db4o
依赖项确实有问题:它在 Maven 中心也不可用在 DataNucleus repository 。我不明白用户应该如何使用 datanucleus-db4o 工件。
I downloaded a newer Version of db4o and added it to the classpath. Maven keeps writing about the missing artifact.
不确定您到底做了什么,但也许以下方法会起作用:排除无法解析的依赖项,并将其替换为 db4o 存储库中的等效项。
<dependencies>
...
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-db4o</artifactId>
<version>2.1.1</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>db4o</groupId>
<artifactId>db4o</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.db4o</groupId>
<artifactId>db4o-full-java5</artifactId>
<version>7.12-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
...
<repository>
<id>db4o</id>
<url>https://source.db4o.com/maven</url>
</repository>
</repositories>
我不知道这是否行得通。
Also I've got NoClassDefFound errors when I launch my application. This leads me to the other question:
不能说,因为您没有发布错误。但请尝试以上方法。
关于eclipse - Maven 缺少传递依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3679232/