0

In a maven project I am trying to add the plugins for code coverage and find bugs in the pom.xml, I have pasted the error trace. If I remove the plugins it works fine. Any suggestions?

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 -

[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
messivanio
  • 2,263
  • 18
  • 24
tinker_fairy
  • 1,323
  • 1
  • 15
  • 18
  • i was facing issue similar to this http://stackoverflow.com/questions/9751219/why-does-maven-download-different-versions-of-spring-artifacts now it is fixed – tinker_fairy Jan 24 '13 at 11:59

3 Answers3

0

Try this

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

All the Best

Dhaval Shah
  • 9,042
  • 2
  • 14
  • 21
0

I think one of your spring dependencies need spring-aop:3.0.0.RC3 You have 2 possiblities: 1. Try to find out where and Exclude it. 2. org.springframework spring-aop 3.0.0.RC3

artifact org.springframework:spring-aop:jar:3.0.0.RC3 in maven-central ( some url ) The maven could't find the dependency your are looking for on the repositories. If you have your own repository server try to download/upload on it

Festus Tamakloe
  • 11,231
  • 9
  • 53
  • 65
0

I was not aware the findbugs and cobertura plugin can be run within the package phase? These are reporting plugins which usually run in the site creation. The life cycle for a project build and site are different: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference

Since both reports (findbugs and cobertura) take quite some time I would not run them within the package phase.

Usually you configure them as reporting plugins and run them using mvn site: see http://mojo.codehaus.org/findbugs-maven-plugin/usage.html The cobertura plugin is (weird?) not configured as reporting plugin: http://mojo.codehaus.org/cobertura-maven-plugin/usage.html

but no phase is configured. That might cause the evil.

The error you get: Could not find artifact org.springframework:spring-aop:jar:3.0.0.RC3 is a bit strange as the dependency in the pom above has a different version. Also the artifactId is different (demo-webservice vs webservice-demo) in the pom and the error message. Are these projects related? Execute mvn dependency:tree to figure out where that aop 3.0.0.RC3 version comes from.

And please change the version to 1-SNAPSHOT, otherwise maven thinks it is a released version (without the -SNAPSHOT suffix.

Hope this helped a little :)

wemu
  • 7,952
  • 4
  • 30
  • 59