[ http://jira.codehaus.org/browse/MCHECKSTYLE-90?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benjamin Bentmann updated MCHECKSTYLE-90: ----------------------------------------- Attachment: dependency-order.patch bq. Why on earth does commons-collections 2.0 win here, when 2.1 is newer The [Introduction to the Dependency Mechanism|http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html] states that for dependencies, that occur at the same depth, the one that is encountered first wins. Versions are not considered. For the Checkstyle plugin, the relevant parts of the current dep tree are {noformat} [INFO] org.apache.maven.plugins:maven-checkstyle-plugin:maven-plugin:2.2-SNAPSHOT [INFO] +- org.codehaus.plexus:plexus-velocity:jar:1.1.2:compile [INFO] | +- commons-collections:commons-collections:jar:2.0:compile [INFO] +- checkstyle:checkstyle:jar:4.4:compile [INFO] | +- commons-collections:commons-collections:jar:2.1:compile {noformat} That is commons-collections:2.0 is introduced first by plexus-velocity and hence wins. Simply putting the dependency on checkstyle before plexus-velocity in the POM should fix it (see patch). > Checkstyle-2.2-SNAPSHOT not working with Maven 2.0.9 > ---------------------------------------------------- > > Key: MCHECKSTYLE-90 > URL: http://jira.codehaus.org/browse/MCHECKSTYLE-90 > Project: Maven 2.x Checkstyle Plugin > Issue Type: Bug > Affects Versions: 2.2 > Reporter: Ricky Hazelwood > Attachments: checkstyle-bug.zip, dependency-order.patch > > > The changes in Maven 2.0.9 is causing the plugin to use commons-collection > 2.0 instead of 2.1 required by checkstyle. Forcing the commons-collection > version 2.1 in the plugin config fixes this issue. > [INFO] [checkstyle:checkstyle] > [FATAL ERROR] org.apache.maven.plugin.checkstyle.CheckstyleReport#execute() > caused a linkage error (java.lang.NoClassDefFoundError) and may be > out-of-date. Check the realms: > [FATAL ERROR] Plugin realm = > app0.child-container[org.apache.maven.plugins:maven-checkstyle-plugin] > urls[0] = > file:/D:/maven2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.2-SNAPSHOT/maven-checkstyle-plugin-2.2-SNAPSHOT.jar > urls[1] = > file:/D:/maven2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar > urls[2] = > file:/D:/maven2/repository/org/apache/maven/reporting/maven-reporting-impl/2.0/maven-reporting-impl-2.0.jar > urls[3] = > file:/D:/maven2/repository/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar > urls[4] = file:/D:/maven2/repository/oro/oro/2.0.7/oro-2.0.7.jar > urls[5] = > file:/D:/maven2/repository/doxia/doxia-core/1.0-alpha-4/doxia-core-1.0-alpha-4.jar > urls[6] = > file:/D:/maven2/repository/org/codehaus/plexus/plexus-resources/1.0-alpha-4/plexus-resources-1.0-alpha-4.jar > urls[7] = > file:/D:/maven2/repository/org/codehaus/plexus/plexus-velocity/1.1.2/plexus-velocity-1.1.2.jar > urls[8] = > file:/D:/maven2/repository/commons-collections/commons-collections/2.0/commons-collections-2.0.jar > urls[9] = > file:/D:/maven2/repository/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar > urls[10] = file:/D:/maven2/repository/velocity/velocity/1.4/velocity-1.4.jar > urls[11] = > file:/D:/maven2/repository/velocity/velocity-dep/1.4/velocity-dep-1.4.jar > urls[12] = > file:/D:/maven2/repository/checkstyle/checkstyle/4.4/checkstyle-4.4.jar > urls[13] = file:/D:/maven2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar > urls[14] = > file:/D:/maven2/repository/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar > urls[15] = > file:/D:/maven2/repository/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar > urls[16] = > file:/D:/maven2/repository/checkstyle/checkstyle-optional/4.4/checkstyle-optional-4.4.jar > [FATAL ERROR] Container realm = plexus.core > urls[0] = file:/C:/Program Files/Java/maven/lib/maven-2.0.9-uber.jar > [INFO] > ------------------------------------------------------------------------ > [ERROR] FATAL ERROR > [INFO] > ------------------------------------------------------------------------ > [INFO] org/apache/commons/collections/ReferenceMap > org.apache.commons.collections.ReferenceMap > [INFO] > ------------------------------------------------------------------------ > [INFO] Trace > java.lang.NoClassDefFoundError: org/apache/commons/collections/ReferenceMap > at > com.puppycrawl.tools.checkstyle.checks.duplicates.StrictDuplicateCodeCheck.<init>(StrictDuplicateCodeCheck.java:191) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) > at java.lang.reflect.Constructor.newInstance(Constructor.java:513) > at java.lang.Class.newInstance0(Class.java:355) > at java.lang.Class.newInstance(Class.java:308) > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.createObject(PackageObjectFactory.java:110) > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.doMakeObject(PackageObjectFactory.java:87) > at > com.puppycrawl.tools.checkstyle.PackageObjectFactory.createModule(PackageObjectFactory.java:149) > at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:140) > at > com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:208) > at > org.apache.maven.plugin.checkstyle.CheckstyleReport.executeCheckstyle(CheckstyleReport.java:870) > at > org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:587) > at > org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98) > at > org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73) > at > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:931) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:767) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:529) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291) > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:287) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) > at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) > at org.codehaus.classworlds.Launcher.main(Launcher.java:375) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) > Caused by: java.lang.ClassNotFoundException: > org.apache.commons.collections.ReferenceMap > at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > at > org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195) > at > org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255) > at > org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274) > at > org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214) > at java.lang.ClassLoader.loadClass(ClassLoader.java:251) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) > ... 42 more -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira