Maven 缺少传递依赖

发布于 2024-09-18 01:57:12 字数 1240 浏览 3 评论 0原文

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

I have a maven project with a dependency (datanucleus-db4o). This dependency has itself a dependency on db4o (db4o:db4o:jar:7.12.126.14142-all-java5).

Now maven says:

09.09.10 19:43:09 MESZ: Missing artifact db4o:db4o:jar:7.12.126.14142-all-java5:compile

I am new to maven. Is it right that datanucleus-db4o defines its own dependency with a specific version number? Is this a good way? m2eclipse can't download it. I downloaded a newer Version of db4o and added it to the classpath. Maven keeps writing about the missing artifact.

Also I've got NoClassDefFound errors when I launch my application. This leads me to the other question:

Am I doing something wrong?

Thanks in advance.

Here is the relevant part of the 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>

and here is the relevant part of the pom.xml of

<dependency>
  <groupId>db4o</groupId>
  <artifactId>db4o</artifactId>
  <version>7.12.126.14142-all-java5</version>
</dependency>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟酒忠诚 2024-09-25 01:57:12

datanucleus-db4o 是否使用特定版本号定义了自己的依赖项?这是个好方法吗?

我不确定我是否理解了这个问题...无论如何,datanucleus-db4o 工件的 db4o:db4o 依赖项确实有问题:它在 Maven 中心和 < a href="http://www.datanucleus.org/downloads/maven2" rel="nofollow noreferrer">DataNucleus 存储库。我不明白用户应该如何使用 datanucleus-db4o 工件。

我下载了较新版本的 db4o 并将其添加到类路径中。 Maven 一直在写有关缺失工件的文章。

不确定您到底做了什么,但也许以下方法会起作用:排除无法解析的依赖项,并将其替换为 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>

我不知道这当然行得通。

此外,当我启动应用程序时,我遇到了 NoClassDefFound 错误。这引出了另一个问题:

不能说,因为您没有发布错误。但请尝试上面的方法。

Is it right that datanucleus-db4o defines its own dependency with a specific version number? Is this a good way?

I'm not sure I understood the question... Anyway, there is indeed something wrong with the db4o:db4o dependency of the datanucleus-db4o artifact: it is not available in Maven central nor in the DataNucleus repository. I don't understand how users are supposed to use the datanucleus-db4o artifact.

I downloaded a newer Version of db4o and added it to the classpath. Maven keeps writing about the missing artifact.

Not sure what you did exactly but maybe the following will work: exclude the dependency that can't be resolved and replace it with some equivalent from the db4o repository.

<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>

I have no idea if this will work of course.

Also I've got NoClassDefFound errors when I launch my application. This leads me to the other question:

Can't say since you didn't post the error. But give the above a try.

零度℉ 2024-09-25 01:57:12

所需的文件不在 Maven 存储库中,但在 datanucleus zip 文件(具有所有依赖项的文件)中。查看 /deps 文件夹。

我将它解压并使用以下命令将其安装到本地maven存储库中:

./mvn install:install-file -Dfile=/home/myUser/Downloads/db4o-7.12.126.14142-all-java5.jar -DgroupId=db4o -DartifactId=db4o -Dversion=7.12.126.14142-all-java5 -Dpackaging=jar

之后它被maven找到。现在还有其他问题正在发生。我会尝试自己解决这些问题...

似乎 JDO 或 Datanucleus 的东西目前组织得不好。我认为他们重构了一些类,现在在某些版本中找不到它们,并且实现与 api 等不兼容。

The required file is not in the maven repositories, but it is in the datanucleus zip file (that one with all dependencies). Look into the /deps folder.

I unpacked it and installed it into the local maven repository with this command:

./mvn install:install-file -Dfile=/home/myUser/Downloads/db4o-7.12.126.14142-all-java5.jar -DgroupId=db4o -DartifactId=db4o -Dversion=7.12.126.14142-all-java5 -Dpackaging=jar

After that it is found by maven. Now there are other problems going on. I'll try to solve them myself...

Seems like the JDO or Datanucleus stuff is not well organized at the moment. I think they refactored some classes and now they can't be found at some versions and implementations are incompatible with the api and such stuff.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文