在maven项目中,我正在尝试添加代码覆盖的插件并在pom.xml中查找错误,我已粘贴错误跟踪。如果我删除插件它工作正常。 有什么建议吗?
的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-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.clusters.demo</groupId>
<artifactId>webservice-demo</artifactId>
<version>1</version>
<packaging>war</packaging>
<name>demo</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<effort>Max</effort>
<failOnError>true</failOnError>
<threshold>High</threshold>
<xmlOutput>true</xmlOutput>
</configuration>
<executions>
<execution>
<id>findbugs-report</id>
<phase>package</phase>
<goals>
<goal>findbugs</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>maven-central</id>
<url>some url</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<id>maven-snapshots</id>
<url>some url</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.1.Final</version>
<!--scope>provided</scope -->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate3</artifactId>
<version>2.0.8</version>
</dependency>
<!--dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.19</version>
</dependency>
</dependencies>
</project>
错误 -
[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
答案 0 :(得分:0)
试试这个
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.0.0.RC3</version>
</dependency>
所有最好的
答案 1 :(得分:0)
我认为你的一个春天依赖需要spring-aop:3.0.0.RC3 你有2个可能性: 1.试着找出它并排除它。 2。 org.springframework 春天的AOP 3.0.0.RC3
artifact org.springframework:spring-aop:jar:3.0.0.RC3 in maven-central(some url)maven无法找到你在存储库中寻找的依赖项。如果您有自己的存储库服务器,请尝试下载/上传
答案 2 :(得分:0)
我不知道findbugs和cobertura插件可以在包阶段运行吗?这些是报告通常在网站创建中运行的插件。项目构建和站点的生命周期是不同的:http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference
由于两个报告(findbugs和cobertura)需要相当长的时间,我不会在包装阶段运行它们。
通常将它们配置为报告插件并使用mvn site
运行它们:
见http://mojo.codehaus.org/findbugs-maven-plugin/usage.html
cobertura插件(奇怪?)未配置为报告插件:
http://mojo.codehaus.org/cobertura-maven-plugin/usage.html
但未配置阶段。这可能会导致邪恶。
你得到的错误:Could not find artifact org.springframework:spring-aop:jar:3.0.0.RC3
有点奇怪,因为上面pom中的依赖项有不同的版本。另外,artifactId在pom和错误消息中是不同的(demo-webservice vs webservice-demo)。这些项目是否相关?
执行mvn dependency:tree
以确定aop 3.0.0.RC3版本的来源。
请将版本更改为1-SNAPSHOT,否则maven认为它是已发布的版本(没有-SNAPSHOT后缀。
希望这有点帮助:)