Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何添加maven插件-查找bug、代码覆盖率_Java_Maven_Code Coverage_Findbugs - Fatal编程技术网

Java 如何添加maven插件-查找bug、代码覆盖率

Java 如何添加maven插件-查找bug、代码覆盖率,java,maven,code-coverage,findbugs,Java,Maven,Code Coverage,Findbugs,在一个maven项目中,我试图添加用于代码覆盖的插件,并在pom.xml中查找bug,我粘贴了错误跟踪。如果我删除插件,它工作正常。 有什么建议吗 pom.xml 4.0.0 com.clusters.demo Web服务演示 1. 战争 演示 http://maven.apache.org org.codehaus.mojo findbugs maven插件 2.4.0 马克斯 真的 高 真的 findbugs报告 包裹 芬德布格斯 org.codehaus.mojo cobertura m

在一个maven项目中,我试图添加用于代码覆盖的插件,并在pom.xml中查找bug,我粘贴了错误跟踪。如果我删除插件,它工作正常。 有什么建议吗

pom.xml


4.0.0
com.clusters.demo
Web服务演示
1.
战争
演示
http://maven.apache.org
org.codehaus.mojo
findbugs maven插件
2.4.0
马克斯
真的
高
真的
findbugs报告
包裹
芬德布格斯
org.codehaus.mojo
cobertura maven插件
2.2
html
xml
包裹
科贝图拉
UTF-8
假的
马文中心酒店
一些url
假的
maven快照
一些url
log4j
log4j
1.2.14
org.hibernate
休眠注释
3.5.6-最终版本
org.hibernate
休眠实体管理器
4.0.1.最终版本
org.hibernate
休眠验证器
4.2.0.4最终版本
org.springframework
spring上下文
3.1.1.1发布
org.springframework
弹簧试验
3.1.1.1发布
org.springframework
SpringJDBC
3.1.1.1发布
org.springframework
春季冬眠3
2.0.8
org.springframework
德克萨斯州春季
3.1.1.1发布
org.springframework
春季asm
3.1.1.1发布
org.springframework
春季aop
3.1.1.1发布
org.springframework
春季甲虫
3.1.1.1发布
org.springframework
弹簧芯
3.1.1.1发布
org.springframework
弹簧网
3.1.1.1发布
org.springframework
SpringWebMVC
3.1.1.1发布
org.springframework
弹簧oxm
3.1.1.1发布
公地郎
公地郎
2.4
org.slf4j
slf4j-log4j12
1.5.8
罐子
编译
org.slf4j
slf4j api
1.5.8
编译
com.oracle
ojdbc14
10.2.0.1.0
公地收藏
公地收藏
3.2.1
朱尼特
朱尼特
4.8.1
公地郎
公地郎
2.4
org.freemarker
自由标记
2.3.19
错误-

[ERROR] Failed to execute goal on project demo-webservice: Could not re
solve dependencies for project com.clusters.demo:demo-webservice:war:1: Cou
ld not find artifact org.springframework:spring-aop:jar:3.0.0.RC3 in maven-centr
al ( some url ) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
试试这个

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-aop</artifactId>
  <version>3.0.0.RC3</version>
</dependency>

org.springframework
春季aop
3.0.0.RC3

最好的

我认为您的一个spring依赖项需要springaop:3.0.0.RC3 您有两种可能性: 1.试着找出它的位置并排除它。 2. org.springframework 春季aop 3.0.0.RC3


maven central中的artifact org.springframework:spring aop:jar:3.0.0.RC3(一些url)maven找不到您在存储库中寻找的依赖项。如果您有自己的存储库服务器,请尝试在其上下载/上载

我不知道findbugs和cobertura插件可以在包阶段运行?这些是通常在网站创建中运行的报告插件。项目构建和站点的生命周期不同:

由于这两个报告(findbugs和cobertura)都需要相当长的时间,所以我不会在包阶段运行它们

通常您将它们配置为报告插件,并使用mvn站点运行它们: 看见 cobertura插件(奇怪?)未配置为报告插件:

但没有配置任何阶段。那可能会导致邪恶

您得到的错误:
无法找到工件org.springframework:springaop:jar:3.0.0。RC3
有点奇怪,因为上面pom中的依赖项有不同的版本。此外,pom和错误消息中的artifactId不同(demo-webservice与webservice-demo)。这些项目相关吗? 执行
mvn dependency:tree
,找出AOP3.0.0.RC3版本的来源

请将版本更改为1-SNAPSHOT,否则maven认为它是已发布的版本(没有-SNAPSHOT后缀)


希望这有点帮助:)

我曾经遇到过类似的问题,现在已经解决了