eclipse - Maven 缺少传递依赖

标签 eclipse maven-2 dependencies m2eclipse dependency-management

我有一个带有依赖项的 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/

相关文章:

java - 摆脱无法转换为 String 的 org.eclipse.osgi.internal.framework.EquinoxConfiguration$1

maven-2 - 如何将我的源代码树中的文件添加到 Maven 站点

eclipse - 使用 Maven2 的新项目

android - 所有 com.android.support 库必须使用完全相同的版本规范 28.0.0 vs 26.1.0

java - Gradle 可以解决依赖关系并正常构建/运行,但 IntelliJ 不能

eclipse - 64 位 Kubuntu 中 Subclipse 的不兼容 JavaHL 库

java - 无法从本地 Maven 存储库添加项目作为依赖项

java - 通过 URL 处理程序在 Eclipse 中打开文件

maven-2 - 使用 maven2 自动化 NSIS 脚本构建

maven - Gradle 和本地 Ivy 存储库未找到传递依赖项