Return-Path: X-Original-To: apmail-maven-issues-archive@minotaur.apache.org Delivered-To: apmail-maven-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC1977133 for ; Wed, 3 Aug 2011 08:32:23 +0000 (UTC) Received: (qmail 29478 invoked by uid 500); 3 Aug 2011 08:32:22 -0000 Delivered-To: apmail-maven-issues-archive@maven.apache.org Received: (qmail 29170 invoked by uid 500); 3 Aug 2011 08:32:09 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 29149 invoked by uid 99); 3 Aug 2011 08:32:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2011 08:32:08 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [63.246.2.115] (HELO codehaus01.managed.contegix.com) (63.246.2.115) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2011 08:32:03 +0000 Received: from codehaus01.managed.contegix.com (localhost.localdomain [127.0.0.1]) by codehaus01.managed.contegix.com (Postfix) with ESMTP id 06B1F458038 for ; Wed, 3 Aug 2011 03:31:43 -0500 (CDT) Date: Wed, 3 Aug 2011 03:31:43 -0500 (CDT) From: "Olivier Lamy (JIRA)" To: issues@maven.apache.org Message-ID: <26121700.29114.1312360303025.JavaMail.haus-jira@codehaus01.managed.contegix.com> In-Reply-To: <4903009.28480.1312258183225.JavaMail.haus-jira@codehaus01.managed.contegix.com> Subject: [jira] Closed: (MCHECKSTYLE-163) Test classpath resolution fails in mvn check:check when includeTestSourceDirectory = true MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 22cf62d5d84cf5bea94eb3b65e0ebd09 [ https://jira.codehaus.org/browse/MCHECKSTYLE-163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Olivier Lamy closed MCHECKSTYLE-163. ------------------------------------ Resolution: Fixed fixed in [rev 1153384|http://svn.apache.org/viewvc?view=revision&sortby=log&revision=1153384] Thanks ! > Test classpath resolution fails in mvn check:check when includeTestSourceDirectory = true > ----------------------------------------------------------------------------------------- > > Key: MCHECKSTYLE-163 > URL: https://jira.codehaus.org/browse/MCHECKSTYLE-163 > Project: Maven 2.x Checkstyle Plugin > Issue Type: Bug > Affects Versions: 2.6 > Reporter: Chris Whelan > Assignee: Olivier Lamy > Fix For: 2.7 > > Attachments: MCHECKSTYLE-163.zip, resolveTestClasspath.patch > > > When includeTestSourceDirectory=true is set for maven-checkstyle-plugin, the full test classpath should be made available to checkstyle. Patch included to resolve issue by setting @requiresDependencyResolution to test. > In DefaultCheckstyleExecutor.java the checker.setClassLoader() is configured using the classpath string from request.getProject().getTestClasspathElements() (see DefaultCheckstyleExecutor line 114). > However, the CheckstyleViolationCheckMojo only has @requiresDependencyResolution compile which means that pom dependencies which have been declared as test are not returned by project.getTestClasspathElements(). > This is a particular issue for the checkstyle RedundantThrows check (http://checkstyle.sourceforge.net/config_coding.html#RedundantThrows) as it requires all Exceptions to be available on it's classpath. > If code throws an Exception which has been imported from a maven test dependency, the exception will not be available on the classpath and this checkstyle check will fail. > Example: > Include junit as a test scope dependency in the project POM: > > junit > junit > ${junit.version} > test > > Throw any junit exception within project test code, e.g.: > public class MyCustomTestRunner extends BlockJUnit4ClassRunner { > public MyCustomTestRunner(final Class klass) throws InitializationError { > If RedundantThrows check is enabled, the following error will be thrown: > [INFO] --- maven-checkstyle-plugin:2.7-SNAPSHOT:check (checkstyle-verify) @ sample-project --- > [INFO] Starting audit... > C:\Working\hg\sample-project\src\test\java\com\sample\support\junit\MyCustomTestRunner.java:28:72: warning: Unable to get class information for InitializationError. > Audit done. > [ERROR] MyCustomTestRunner.java[28:72] Unable to get class information for InitializationError. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira