由于 pom.xml 中存在错误,无法使用 Maven 运行构建

发布于 2024-12-18 16:47:01 字数 1645 浏览 4 评论 0原文

我正在尝试在 Eclipse 中构建一个新的 Maven 项目。 在我的 pom.xml 中,我收到一个错误,指出

在这一行找到多个注释: - 缺少工件 maven-plugins:maven-findbugs-plugin:plugin:1.3.1 - 缺少工件 maven-plugins:maven-cobertura-plugin:plugin:1.3

这是我在 pom.xml 中“cobertura”的依赖代码:

   <dependency>
        <groupId>maven-plugins</groupId>
        <artifactId>maven-cobertura-plugin</artifactId>
        <version>1.3</version>
        <type>plugin</type>
    </dependency>

我尝试添加存储库,如下所示,但仍然不起作用。

  <repositories>
    <repository>
        <id>repository.maven-plugins.sourceforge.net</id>
        <name>maven plug-in repository</name>
        <url>http://maven-plugins.sourceforge.net/repository</url>
    </repository>
    <repository>
        <id>repository.ibiblio.org-maven</id>
        <name>ibiblio repository</name>
        <url>http://www.ibiblio.org/maven</url>
    </repository>
</repositories>

此处链接到 Maven 插件
http://maven-plugins.sourceforge.net/maven -findbugs-plugin/announcements/announcement-1.3.1.txt

http://maven-plugins.sourceforge.net/maven-cobertura -plugin/announcements/announcement-1.3.txt

我不想手动安装这些插件。我需要通过在 pom.xml 中声明它们来自动安装它们

请帮忙。

谢谢

I am trying to build a new Maven project in Eclipse.
In my pom.xml, I got an error which says

Multiple annotations found at this line:
- Missing artifact maven-plugins:maven-findbugs-plugin:plugin:1.3.1
- Missing artifact maven-plugins:maven-cobertura-plugin:plugin:1.3

Here is my dependency code for "cobertura" in pom.xml:

   <dependency>
        <groupId>maven-plugins</groupId>
        <artifactId>maven-cobertura-plugin</artifactId>
        <version>1.3</version>
        <type>plugin</type>
    </dependency>

I tried adding repositories as below, but still didn't work.

  <repositories>
    <repository>
        <id>repository.maven-plugins.sourceforge.net</id>
        <name>maven plug-in repository</name>
        <url>http://maven-plugins.sourceforge.net/repository</url>
    </repository>
    <repository>
        <id>repository.ibiblio.org-maven</id>
        <name>ibiblio repository</name>
        <url>http://www.ibiblio.org/maven</url>
    </repository>
</repositories>

Links to Maven plugins here
http://maven-plugins.sourceforge.net/maven-findbugs-plugin/announcements/announcement-1.3.1.txt

http://maven-plugins.sourceforge.net/maven-cobertura-plugin/announcements/announcement-1.3.txt

I don't want to do Manual installation for these plugins. I need to install them automatically by declaring them in pom.xml

Please help.

Thanks

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

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

发布评论

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

评论(2

小情绪 2024-12-25 16:47:01

作为一个相关问题,我发现例如 jaxen-1.1.3 引用了上述 maven1 工件。 Eclipse 中的 POM 编辑器向您显示依赖关系层次结构。它添加了以下内容来选择显式排除:

    <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1.3</version>
        <exclusions>
            <exclusion>
                <artifactId>maven-cobertura-plugin</artifactId>
                <groupId>maven-plugins</groupId>
            </exclusion>
            <exclusion>
                <artifactId>maven-findbugs-plugin</artifactId>
                <groupId>maven-plugins</groupId>
            </exclusion>
        </exclusions>
    </dependency>

As a related issue, I found that e.g. jaxen-1.1.3 references the above maven1 artifacts. The POM editor in Eclipse shows you the dependency hierarchy. It added the following for selecting explicit excludes:

    <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1.3</version>
        <exclusions>
            <exclusion>
                <artifactId>maven-cobertura-plugin</artifactId>
                <groupId>maven-plugins</groupId>
            </exclusion>
            <exclusion>
                <artifactId>maven-findbugs-plugin</artifactId>
                <groupId>maven-plugins</groupId>
            </exclusion>
        </exclusions>
    </dependency>
望笑 2024-12-25 16:47:01

这些是 maven 1 插件,不适用于 maven 2。这些是插件的当前版本。

您可以在其中定义插件 标签而不是 标签。另请注意下面这些插件的 groupIdartifactId 的变化...

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.5.1</version>   
 </plugin>

 <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <version>2.3.3</version>    
  </plugin>

These are maven 1 plugins and will not work with maven 2. These are the current versions of the plugins.

You would define plugins within <plugins> tag and not <dependencies> tag. Also note the change in groupId and artifactId for these plugins below...

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.5.1</version>   
 </plugin>

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