Author: dennisl
Date: Sun Feb 3 04:27:47 2008
New Revision: 617979
URL: http://svn.apache.org/viewvc?rev=617979&view=rev
Log:
[MCHECKSTYLE-40] Some checks need the compiled classes (for instance
JavadocMethod)
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=617979&r1=617978&r2=617979&view=diff
==============================================================================
---
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
(original)
+++
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
Sun Feb 3 04:27:47 2008
@@ -792,14 +792,17 @@
// setup classloader, needed to avoid "Unable to get class information
// for ..." errors
List classPathStrings;
+ List outputDirectories = new ArrayList();
try
{
classPathStrings = this.project.getCompileClasspathElements();
+ outputDirectories.add(
this.project.getBuild().getOutputDirectory() );
if ( includeTestSourceDirectory && ( testSourceDirectory != null )
&& ( testSourceDirectory.exists() )
&& ( testSourceDirectory.isDirectory() ) )
{
classPathStrings = this.project.getTestClasspathElements();
+ outputDirectories.add(
this.project.getBuild().getTestOutputDirectory() );
}
}
catch ( DependencyResolutionRequiredException e )
@@ -817,6 +820,34 @@
urls.add( new File( ( (String) iter.next() ) ).toURL() );
}
catch ( MalformedURLException e )
+ {
+ throw new MavenReportException( e.getMessage(), e );
+ }
+ }
+
+ Iterator iterator = outputDirectories.iterator();
+ while ( iterator.hasNext() )
+ {
+ try
+ {
+ String outputDirectoryString = (String) iterator.next();
+ if ( outputDirectoryString != null )
+ {
+ File outputDirectoryFile = new File( outputDirectoryString
);
+ if ( outputDirectoryFile.exists() )
+ {
+ URL outputDirectoryUrl = outputDirectoryFile.toURL();
+ getLog().debug( "Adding the outputDirectory " +
outputDirectoryUrl.toString() +
+ " to the Checkstyle class path" );
+ urls.add( outputDirectoryUrl );
+ }
+ }
+ }
+ catch ( MalformedURLException e )
+ {
+ throw new MavenReportException( e.getMessage(), e );
+ }
+ catch ( IOException e )
{
throw new MavenReportException( e.getMessage(), e );
}