缺少工件 com.sun.jdmk:jmxtools:jar:1.2.1

发布于 2024-12-29 16:26:15 字数 1861 浏览 0 评论 0原文

我已经在 Eclipse Indigo 下从 maven-achetype-quickstart 创建了简单的项目,然后我转到 pom.xml gui 编辑器,并在依赖项选项卡中通过在适当的对话框中搜索添加了依赖项 log4j 。现在我的pom.xml看起来像

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org xsd/maven-.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup</groupId>
  <artifactId>Test_Maven_03</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Test_Maven_03</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
    </dependency>
  </dependencies>
  <dependencyManagement>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
    </dependency>
</dependencies>
  </dependencyManagement>
</project>

Eclipse说我的POM有很多问题,比如

Missing artifact javax.jms:jms:jar:1.1 pom.xml /Test_Maven_03 line 2 Maven Dependency Problem

这是什么意思以及如何查看自动jar下载的maven功能。

编辑1 如果我选择 log4j 1.2.16 而不是 1.2.15,则会收到另一个错误:缺少工件 log4j:log4j:bundle:1.2.16。所以我根本看不到自动 jar 管理。

I have created simple project from maven-achetype-quickstart under Eclipse Indigo, then I went to pom.xml gui editor and in dependencies tab added dependency log4j by search in appropriate dialog. Now my pom.xml looks like

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org xsd/maven-.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup</groupId>
  <artifactId>Test_Maven_03</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Test_Maven_03</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
    </dependency>
  </dependencies>
  <dependencyManagement>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
    </dependency>
</dependencies>
  </dependencyManagement>
</project>

Eclipse says my POM have many problems like

Missing artifact javax.jms:jms:jar:1.1 pom.xml /Test_Maven_03 line 2 Maven Dependency Problem

What does it mean and how to see maven feature of automatic jar downloading.

EDIT 1
If I select log4j 1.2.16 instead of 1.2.15, I get another error: Missing artifact log4j:log4j:bundle:1.2.16. So I see no automatic jar management at all.

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

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

发布评论

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

评论(4

我的痛♀有谁懂 2025-01-05 16:26:16

如果我没记错的话,由于许可问题,它不再包含在内。如果您不需要 jms 功能,您可以从 log4j 依赖项中排除 jms:

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
    <exclusion>
        <groupId>com.sun.jmx</groupId>
        <artifactId>jmxri</artifactId>
    </exclusion>
    <exclusion>
        <groupId>com.sun.jdmk</groupId>
        <artifactId>jmxtools</artifactId>
    </exclusion>
    <exclusion>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
    </exclusion>
</exclusions>
</dependency>

It's not included anymore due to licensing issues if I remember correctly. If you don't need jms functionality you can exclude jms from log4j dependency:

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
    <exclusion>
        <groupId>com.sun.jmx</groupId>
        <artifactId>jmxri</artifactId>
    </exclusion>
    <exclusion>
        <groupId>com.sun.jdmk</groupId>
        <artifactId>jmxtools</artifactId>
    </exclusion>
    <exclusion>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
    </exclusion>
</exclusions>
</dependency>
浴红衣 2025-01-05 16:26:16

将log4j的版本更改为1.2.16。

正如您所发现的,1.2.15 的元数据很糟糕,因为中央存储库中缺少依赖项。但是,有一项政策是不更改中央 Maven 存储库中的工件或元数据,因为这可能会导致构建不可重复。也就是说,如果工件或其元数据发生更改,构建的行为可能会有所不同。

原因是解决错误的元数据比导致不可重现的构建更好。

当然,如果项目维护者对上传到中央的元数据更加小心,那就更好了。

Change the version of log4j to 1.2.16.

The metadata for 1.2.15 is bad, as you have discovered, because the dependencies are missing from the central repository. However, there is a policy of not changing artifacts or metadata in the central maven repository, because this can lead to builds being unrepeatable. That is, a build might behave differently if an artifact or its metadata changed.

The reasoning is that it's better to work around bad metadata than cause unreproducible builds.

It's better, of course, if project maintainers are more careful about the metadata that they upload to central.

我家小可爱 2025-01-05 16:26:16

使用Log4J 1.2.16(我在您之前的问题中链接到的那个);它没有旧的 JMX 依赖项,而是从 Geronimo 获取它。

Use Log4J 1.2.16 (the one I linked to in your earlier question); it doesn't have the older JMX dependency and gets it from Geronimo instead.

瀟灑尐姊 2025-01-05 16:26:16

只要您不需要任何 JMX 依赖项,上面的答案(不包括 JMX)就可以。但是,您将永远无法从标准 Maven 存储库下载 JMX 依赖项的 .jar 文件。引用 nabble.com 上的 Jörg Schaible-3

这是正常的,并且会一直如此,因为 Sun/Oracle 从未授予过
这些工件作为单独下载的分发权。你将会有
从 Oracle 下载它们,接受它们的许可证,并将它们添加到
本地存储库管理器。

因此,如果您想使用 JMX,则需要从 Oracle 网站

The answers above (excluding JMX) are fine, so long as you don't need any of the JMX dependencies. However, you will never be able to download the JMX dependencies' .jar files from a standard maven repository. To quote Jörg Schaible-3 at nabble.com:

This is normal and it will stay so, because Sun/Oracle never granted
distribution rights for those artifacts as separate downloads. You will have
to download them from Oracle, accepting their license, and add them to a
local repository manager.

Therefore, if you want to use JMX, you will need to download the respective jmx zip folder from Oracle's website.

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