You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ad...@apache.org on 2018/06/23 16:54:43 UTC
[maven-pmd-plugin] 03/03: [MPMD-266] - Aggregate report in
multi-module projects doesn't use correct auxclasspath
This is an automated email from the ASF dual-hosted git repository.
adangel pushed a commit to branch MPMD-266
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
commit 38c60fd50f23fe82c8feb47d4dd9a38ea6bc1b7c
Author: Andreas Dangel <ad...@apache.org>
AuthorDate: Sat Jun 23 18:45:29 2018 +0200
[MPMD-266] - Aggregate report in multi-module projects doesn't use correct auxclasspath
Refactoring type resolution configuration into own method
---
.../org/apache/maven/plugins/pmd/PmdReport.java | 61 +++++++++++-----------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index bcfb242..0b39c06 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -675,37 +675,9 @@ public class PmdReport
configuration.setDefaultLanguageVersion( languageVersion );
}
- if ( typeResolution && !aggregate )
+ if ( typeResolution )
{
- try
- {
- List<String> classpath =
- includeTests ? project.getTestClasspathElements() : project.getCompileClasspathElements();
- getLog().debug( "Using aux classpath: " + classpath );
- configuration.prependClasspath( StringUtils.join( classpath.iterator(), File.pathSeparator ) );
- }
- catch ( Exception e )
- {
- throw new MavenReportException( e.getMessage(), e );
- }
- }
- else if ( typeResolution && aggregate )
- {
- List<String> classpath = new ArrayList<>();
- try
- {
- for ( MavenProject localProject : reactorProjects )
- {
- classpath.addAll( includeTests ? localProject.getTestClasspathElements()
- : localProject.getCompileClasspathElements() );
- }
- getLog().debug( "Using aggregated aux classpath: " + classpath );
- configuration.prependClasspath( StringUtils.join( classpath.iterator(), File.pathSeparator ) );
- }
- catch ( Exception e )
- {
- throw new MavenReportException( e.getMessage(), e );
- }
+ configureTypeResolution( configuration );
}
if ( null != suppressMarker )
@@ -728,6 +700,35 @@ public class PmdReport
return configuration;
}
+ private void configureTypeResolution( PMDConfiguration configuration ) throws MavenReportException
+ {
+ try
+ {
+ List<String> classpath = new ArrayList<>();
+ if ( aggregate )
+ {
+ for ( MavenProject localProject : reactorProjects )
+ {
+ classpath.addAll( includeTests ? localProject.getTestClasspathElements()
+ : localProject.getCompileClasspathElements() );
+ }
+ getLog().debug( "Using aggregated aux classpath: " + classpath );
+ }
+ else
+ {
+ classpath.addAll( includeTests ? project.getTestClasspathElements()
+ : project.getCompileClasspathElements() );
+ getLog().debug( "Using aux classpath: " + classpath );
+ }
+ String path = StringUtils.join( classpath.iterator(), File.pathSeparator );
+ configuration.prependClasspath( path );
+ }
+ catch ( Exception e )
+ {
+ throw new MavenReportException( e.getMessage(), e );
+ }
+ }
+
/**
* {@inheritDoc}
*/