m2eclipse 失踪神器

发布于 2024-11-08 14:24:46 字数 2406 浏览 0 评论 0原文

我正在尝试开始使用 Maven 和 m2eclipse,但我不断收到丢失工件错误:

在此处输入图像描述

log4j 在我的本地存储库中。我将 m2eclipse 设置为使用 Maven 的外部安装,尽管我意识到对于依赖项解析,它使用嵌入式 Maven。我没有为 Maven 设置任何自定义设置,这是 m2eclipse 和 Maven 的简单安装。我可以通过 m2eclipse 添加我想要的依赖项(例如 log4j),并将它们添加到我的 pom 文件中。我在家里,没有公司或特别严格的防火墙后面。

有人能帮我弄清楚发生了什么事吗?

Pom 文件:

<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-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.xonatype.mavenbook.ch04</groupId>
  <artifactId>simple-weather</artifactId>
  <version>1.0</version>
  <name>Simple Weather</name>

  <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <type>bundle</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>20040902.021138</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.5</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
  </dependencies>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

I am trying to get started with Maven and m2eclipse but I keep getting missing artifact errors:

enter image description here

log4j is in my local repository. I have m2eclipse set up to use an external installation of Maven although I realize that for dependency resolution it uses the embedded maven. I don't have any custom settings for maven set up, this is a plain install of m2eclipse and maven. I am able to add the dependencies I want through m2eclipse (such as log4j) and it adds them to my pom file. I am at home and not behind a corporate or particularly restrictive firewall.

Can anybody help me figure out what is going on?

Pom file:

<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-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.xonatype.mavenbook.ch04</groupId>
  <artifactId>simple-weather</artifactId>
  <version>1.0</version>
  <name>Simple Weather</name>

  <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <type>bundle</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>20040902.021138</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.5</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
  </dependencies>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

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

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

发布评论

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

评论(1

很酷不放纵 2024-11-15 14:24:46

bundle 更改为 jar

change <type>bundle</type> to <type>jar</type>

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