由于pom.xml错误,无法使用Maven运行构建 [英] Couldn't run build using Maven because of an error in pom.xml
问题描述
我正在尝试在Eclipse中构建一个新的Maven项目. 在我的pom.xml中,出现错误消息
I am trying to build a new Maven project in Eclipse. In my pom.xml, I got an error which says
在此行找到多个注释: -缺少工件maven-plugins:maven-findbugs-plugin:plugin:1.3.1 -缺少工件maven-plugins:maven-cobertura-plugin:plugin:1.3
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
这是pom.xml中"cobertura"的依赖代码:
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>
此处链接到Maven插件
http://maven-plugins.sourceforge.net/maven -findbugs-plugin/announcements/announcement-1.3.1.txt
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
我不想为这些插件手动安装.我需要通过在pom.xml中声明它们来自动安装它们
I don't want to do Manual installation for these plugins. I need to install them automatically by declaring them in pom.xml
请帮助.
谢谢
推荐答案
作为一个相关问题,我发现例如jaxen-1.1.3引用了上面的maven1工件. Eclipse中的POM编辑器向您显示了依赖关系层次结构.它为选择显式排除项添加了以下内容:
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>
这篇关于由于pom.xml错误,无法使用Maven运行构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!