You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Simon Schäfer <ma...@antoras.de> on 2013/06/01 02:44:14 UTC

Re: checkstyle-maven-plugin dependency clash

After a long time of searching I eventually found the problem. There are 
incompatible dependencies:

     [ERROR] urls[2] = 
file:/home/antoras/.m2/repository/checkstyle/checkstyle/5.0/checkstyle-5.0.jar

and

     [ERROR] urls[33] = 
file:/home/antoras/.m2/repository/com/puppycrawl/tools/checkstyle/5.6/checkstyle-5.6.jar

The first one has version 5.0, the second one version 5.6. After moving 
from 5.0 to 5.6 everything works fine again.


On 05/31/2013 10:30 PM, Simon Schäfer wrote:
> Hello,
>
> I have asked a question on StackOverflow but no one answered so far. 
> Thus, I hope to find more help here. The original question: 
> http://stackoverflow.com/questions/16837394/checkstyle-maven-plugin-dependency-clash
>
> Below is a copy of the question:
>
>
> I want to use `maven-checkstyle-plugin` but whenever I execute it I 
> get this error:
>
>     % mvn checkstyle:checkstyle                               :(
>     [INFO] Scanning for projects...
>     [INFO]
>     [INFO] 
> ------------------------------------------------------------------------
>     [INFO] Building checkstyle-extension 1.0-SNAPSHOT
>     [INFO] 
> ------------------------------------------------------------------------
>     [INFO]
>     [INFO] --- maven-checkstyle-plugin:2.10:checkstyle (default-cli) @ 
> checkstyle-extension ---
>     [INFO] 
> ------------------------------------------------------------------------
>     [INFO] BUILD FAILURE
>     [INFO] 
> ------------------------------------------------------------------------
>     [INFO] Total time: 1.843s
>     [INFO] Finished at: Thu May 30 15:10:32 CEST 2013
>     [INFO] Final Memory: 12M/159M
>     [INFO] 
> ------------------------------------------------------------------------
>     [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle 
> (default-cli)
>     on project checkstyle-extension: Execution default-cli of goal
> org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle failed:
>     An API incompatibility was encountered while executing
> org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle:
>     java.lang.NoSuchMethodError: 
> com.google.common.collect.Multimaps.newHashMultimap()Lcom/google/common/collect/HashMultimap;
>     [ERROR] -----------------------------------------------------
>     [ERROR] realm = 
> plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.10
>     [ERROR] strategy = 
> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
>     [ERROR] urls[0] = 
> file:/home/antoras/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.10/maven-checkstyle-plugin-2.10.jar
>     [ERROR] urls[1] = 
> file:/home/antoras/.m2/repository/edu/kit/checkstyle/checkstyle-extension/1.0-SNAPSHOT/checkstyle-extension-1.0-SNAPSHOT.jar
>     [ERROR] urls[2] = 
> file:/home/antoras/.m2/repository/checkstyle/checkstyle/5.0/checkstyle-5.0.jar
>     [ERROR] urls[3] = 
> file:/home/antoras/.m2/repository/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar
>     [ERROR] urls[4] = 
> file:/home/antoras/.m2/repository/com/google/guava/guava/14.0/guava-14.0.jar
>     [ERROR] urls[5] = 
> file:/home/antoras/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
>     [ERROR] urls[6] = 
> file:/home/antoras/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
>     [ERROR] urls[7] = 
> file:/home/antoras/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar
>     [ERROR] urls[8] = 
> file:/home/antoras/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.2/maven-reporting-impl-2.2.jar
>     [ERROR] urls[9] = 
> file:/home/antoras/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar
>     [ERROR] urls[10] = 
> file:/home/antoras/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar
>     [ERROR] urls[11] = 
> file:/home/antoras/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar
>     [ERROR] urls[12] = 
> file:/home/antoras/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar
>     [ERROR] urls[13] = 
> file:/home/antoras/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar
>     [ERROR] urls[14] = 
> file:/home/antoras/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
>     [ERROR] urls[15] = 
> file:/home/antoras/.m2/repository/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar
>     [ERROR] urls[16] = 
> file:/home/antoras/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
>     [ERROR] urls[17] = 
> file:/home/antoras/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar
>     [ERROR] urls[18] = 
> file:/home/antoras/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1.3/doxia-sink-api-1.1.3.jar
>     [ERROR] urls[19] = 
> file:/home/antoras/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1.3/doxia-logging-api-1.1.3.jar
>     [ERROR] urls[20] = 
> file:/home/antoras/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.1.3/doxia-decoration-model-1.1.3.jar
>     [ERROR] urls[21] = 
> file:/home/antoras/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.1.3/doxia-site-renderer-1.1.3.jar
>     [ERROR] urls[22] = 
> file:/home/antoras/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.1.3/doxia-module-xhtml-1.1.3.jar
>     [ERROR] urls[23] = 
> file:/home/antoras/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.1.3/doxia-module-fml-1.1.3.jar
>     [ERROR] urls[24] = 
> file:/home/antoras/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar
>     [ERROR] urls[25] = 
> file:/home/antoras/.m2/repository/org/apache/maven/shared/maven-doxia-tools/1.2.1/maven-doxia-tools-1.2.1.jar
>     [ERROR] urls[26] = 
> file:/home/antoras/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar
>     [ERROR] urls[27] = 
> file:/home/antoras/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
>     [ERROR] urls[28] = 
> file:/home/antoras/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
>     [ERROR] urls[29] = 
> file:/home/antoras/.m2/repository/org/codehaus/plexus/plexus-resources/1.0-alpha-7/plexus-resources-1.0-alpha-7.jar
>     [ERROR] urls[30] = 
> file:/home/antoras/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
>     [ERROR] urls[31] = 
> file:/home/antoras/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
>     [ERROR] urls[32] = 
> file:/home/antoras/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar
>     [ERROR] urls[33] = 
> file:/home/antoras/.m2/repository/com/puppycrawl/tools/checkstyle/5.6/checkstyle-5.6.jar
>     [ERROR] urls[34] = 
> file:/home/antoras/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
>     [ERROR] urls[35] = 
> file:/home/antoras/.m2/repository/commons-beanutils/commons-beanutils-core/1.8.3/commons-beanutils-core-1.8.3.jar
>     [ERROR] urls[36] = 
> file:/home/antoras/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
>     [ERROR] urls[37] = 
> file:/home/antoras/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar
>     [ERROR] urls[38] = 
> file:/home/antoras/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
>     [ERROR] urls[39] = 
> file:/home/antoras/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
>     [ERROR] urls[40] = 
> file:/home/antoras/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
>     [ERROR] Number of foreign imports: 1
>     [ERROR] import: Entry[import  from realm ClassRealm[maven.api, 
> parent: null]]
>     [ERROR]
>     [ERROR] -----------------------------------------------------
>     [ERROR] -> [Help 1]
>     [ERROR]
>     [ERROR] To see the full stack trace of the errors, re-run Maven 
> with the -e switch.
>     [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 read the following articles:
>     [ERROR] [Help 1] 
> http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
>
> There seems to be a dependency clash between `guava` and 
> `google-collections`, but I don't know how to solve it.
>
> Here is my pom:
>
>     <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>edu.kit.checkstyle</groupId>
>       <artifactId>checkstyle-extension</artifactId>
>       <version>1.0-SNAPSHOT</version>
>       <packaging>jar</packaging>
>
>       <name>checkstyle-extension</name>
>       <url>http://kit.edu</url>
>
>       <properties>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>       </properties>
>
>       <dependencies>
>         <dependency>
>           <groupId>junit</groupId>
>           <artifactId>junit</artifactId>
>           <version>4.11</version>
>           <scope>test</scope>
>         </dependency>
>
>         <dependency>
>           <groupId>checkstyle</groupId>
>           <artifactId>checkstyle</artifactId>
>           <version>5.0</version>
>         </dependency>
>       </dependencies>
>
>       <reporting>
>         <plugins>
>           <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-checkstyle-plugin</artifactId>
>             <version>2.10</version>
>             <configuration>
> <configLocation>checkstyle.xml</configLocation>
>
> <packageNamesLocation>edu/kit/checkstyle/checks/packagenames.xml</packageNamesLocation> 
>
>             </configuration>
>           </plugin>
>         </plugins>
>       </reporting>
>
>       <build>
>         <plugins>
>           <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-checkstyle-plugin</artifactId>
>             <version>2.10</version>
>             <configuration>
> <enableRulesSummary>false</enableRulesSummary>
>             </configuration>
>             <dependencies>
>               <dependency>
>                 <groupId>edu.kit.checkstyle</groupId>
> <artifactId>checkstyle-extension</artifactId>
>                 <version>1.0-SNAPSHOT</version>
>               </dependency>
>               <dependency>
>                 <groupId>com.google.guava</groupId>
>                 <artifactId>guava</artifactId>
>                 <version>14.0</version>
>                 <exclusions>
>                   <exclusion>
> <groupId>com.google.collections</groupId>
> <artifactId>google-collections</artifactId>
>                   </exclusion>
>                 </exclusions>
>               </dependency>
>               <!--dependency>
> <groupId>com.google.collections</groupId>
> <artifactId>google-collections</artifactId>
>                 <version>1.0</version>
>               </dependency-->
>
>             </dependencies>
>           </plugin>
>         </plugins>
>       </build>
>
>     </project>
>
> I tried do exclude the `google-collections` dependency from `guava` 
> and to specify the `google-collections` dependency directly but 
> neither worked.
>
> It looks that I have a similar problem like in [this question][1]. But 
> the solution there doesn't work for me (add `google-collections` 
> dependency explicitly).
>
> Any ideas on how to solve this?
>
>
>   [1]: 
> http://stackoverflow.com/questions/15874503/maven-checkstyle-plugin-and-guava-google-collections-dependency-clash
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org