Return-Path: X-Original-To: apmail-maven-commits-archive@www.apache.org Delivered-To: apmail-maven-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 088C5E9DD for ; Wed, 20 Feb 2013 19:03:12 +0000 (UTC) Received: (qmail 63354 invoked by uid 500); 20 Feb 2013 19:03:11 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 63264 invoked by uid 500); 20 Feb 2013 19:03:11 -0000 Mailing-List: contact commits-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 commits@maven.apache.org Received: (qmail 63252 invoked by uid 99); 20 Feb 2013 19:03:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2013 19:03:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2013 19:03:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9374023888E7; Wed, 20 Feb 2013 19:02:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1448351 - in /maven/plugins/trunk/maven-dependency-plugin: ./ src/it/resolve-plugins-exclude-reactor/ src/it/resolve-plugins-exclude-reactor/child-a/ src/it/resolve-plugins-exclude-reactor/child-a/src/ src/it/resolve-plugins-exclude-reacto... Date: Wed, 20 Feb 2013 19:02:48 -0000 To: commits@maven.apache.org From: jdcasey@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130220190249.9374023888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jdcasey Date: Wed Feb 20 19:02:48 2013 New Revision: 1448351 URL: http://svn.apache.org/r1448351 Log: [MDEP-401][MDEP-402] Adding excludeReactor parameter and getPluginArtifactsFilter() method, to make use of in/exclude parameters already in existence from the resolve-plugins mojo. Also adding ITs to verify this functionality. Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/pom.xml (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/resources/ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/resources/DoNotDelete.xml (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-b/ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-b/pom.xml (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/invoker.properties (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/pom.xml (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/verify.groovy maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/invoker.properties (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/pom.xml (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/test.properties (with props) maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/verify.groovy Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolvePluginsMojo.java Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?rev=1448351&r1=1448350&r2=1448351&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Wed Feb 20 19:02:48 2013 @@ -141,7 +141,7 @@ under the License. org.codehaus.plexus plexus-archiver - 2.3-SNAPSHOT + 2.3 org.codehaus.plexus Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/pom.xml?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/pom.xml (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/pom.xml Wed Feb 20 19:02:48 2013 @@ -0,0 +1,36 @@ + + + + + 4.0.0 + + + org.apache.maven.its.dependency + test + 1.0-SNAPSHOT + + child-a + maven-plugin + + Resolve-plugins skip reactor plugin + + Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/resources/DoNotDelete.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/resources/DoNotDelete.xml?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/resources/DoNotDelete.xml (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/resources/DoNotDelete.xml Wed Feb 20 19:02:48 2013 @@ -0,0 +1,20 @@ + + + Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-a/src/main/resources/DoNotDelete.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-b/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-b/pom.xml?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-b/pom.xml (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-b/pom.xml Wed Feb 20 19:02:48 2013 @@ -0,0 +1,74 @@ + + + + + 4.0.0 + + + org.apache.maven.its.dependency + test + 1.0-SNAPSHOT + + child-b + pom + + Copy from reactor + + Test dependency:copy when searching the reactor + + + + UTF-8 + + + + + org.apache.maven.its.dependency + child-a + 1.0-SNAPSHOT + + + + + + + maven-dependency-plugin + + + test + + copy + + + + + org.apache.maven.its.dependency + child-a + + + + + + + + + Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/child-b/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/invoker.properties?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/invoker.properties (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/invoker.properties Wed Feb 20 19:02:48 2013 @@ -0,0 +1 @@ +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:resolve-plugins Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/invoker.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/pom.xml?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/pom.xml (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/pom.xml Wed Feb 20 19:02:48 2013 @@ -0,0 +1,62 @@ + + + + + 4.0.0 + + org.apache.maven.its.dependency + test + 1.0-SNAPSHOT + pom + + + child-a + child-b + + + resolve-plugins skip reactor plugins + + Test dependency:resolve-plugins to skip plugins in the reactor + + + + UTF-8 + + + + + + maven-dependency-plugin + @project.version@ + + target/resolved.txt + true + + + + org.apache.maven.its.dependency + child-a + 1.0-SNAPSHOT + + + + Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/verify.groovy?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/verify.groovy (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-exclude-reactor/verify.groovy Wed Feb 20 19:02:48 2013 @@ -0,0 +1,7 @@ +new File(basedir, "target/resolved.txt").eachLine { line -> + if ( line =~ /child-a/ ){ + throw new RuntimeException( "Reactor plugin 'child-a' should be excluded!" ) + } +} + +return true; Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/invoker.properties?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/invoker.properties (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/invoker.properties Wed Feb 20 19:02:48 2013 @@ -0,0 +1 @@ +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:resolve-plugins Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/invoker.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/pom.xml?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/pom.xml (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/pom.xml Wed Feb 20 19:02:48 2013 @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + org.apache.maven.its.dependency + test + 1.0-SNAPSHOT + + Test + + Test dependency:resolve-plugins with excluded artifactId + + + + UTF-8 + + + + + + + maven-dependency-plugin + @project.version@ + + target/resolved.txt + maven-dependency-plugin,maven-surefire-plugin + + + + + + + Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/test.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/test.properties?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/test.properties (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/test.properties Wed Feb 20 19:02:48 2013 @@ -0,0 +1 @@ +outputFile = target/resolved.txt Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/test.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/verify.groovy?rev=1448351&view=auto ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/verify.groovy (added) +++ maven/plugins/trunk/maven-dependency-plugin/src/it/resolve-plugins-with-exclude/verify.groovy Wed Feb 20 19:02:48 2013 @@ -0,0 +1,10 @@ +new File(basedir, "target/resolved.txt").eachLine { line -> + if ( line =~ /maven-surefire-plugin/ ){ + throw new RuntimeException( "Surefire plugin should be excluded!" ) + } + else if ( line =~ /maven-dependency-plugin/ ){ + throw new RuntimeException( "Dependency plugin should be excluded!" ) + } +} + +return true; Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java?rev=1448351&r1=1448350&r2=1448351&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractResolveMojo.java Wed Feb 20 19:02:48 2013 @@ -19,19 +19,26 @@ package org.apache.maven.plugin.dependen * under the License. */ +import java.io.File; +import java.util.Set; + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; +import org.apache.maven.plugin.dependency.utils.DependencyUtil; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.artifact.InvalidDependencyVersionException; - -import java.io.File; -import java.util.Set; +import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter; +import org.apache.maven.shared.artifact.filter.collection.ClassifierFilter; +import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts; +import org.apache.maven.shared.artifact.filter.collection.GroupIdFilter; +import org.apache.maven.shared.artifact.filter.collection.ScopeFilter; +import org.apache.maven.shared.artifact.filter.collection.TypeFilter; /** * @author Brian Fox @@ -75,13 +82,71 @@ public abstract class AbstractResolveMoj @Parameter( property = "appendOutput", defaultValue = "false" ) protected boolean appendOutput; - protected Set resolveDependencyArtifacts( MavenProject theProject ) + /** + * Don't resolve plugins that are in the current reactor. + * Only works for plugins at the moment. + * + * @since 2.7 + */ + @Parameter( property = "excludeReactor", defaultValue = "true" ) + protected boolean excludeReactor; + + protected FilterArtifacts getPluginArtifactsFilter() + { + if ( excludeReactor ) + { + final StringBuilder exAids = new StringBuilder(); + if ( this.excludeArtifactIds != null ) + { + exAids.append( this.excludeArtifactIds ); + } + + for ( final MavenProject rp : reactorProjects ) + { + if ( !"maven-plugin".equals( rp.getPackaging() ) ) + { + continue; + } + + if ( exAids.length() > 0 ) + { + exAids.append( "," ); + } + + exAids.append( rp.getArtifactId() ); + } + + this.excludeArtifactIds = exAids.toString(); + } + + final FilterArtifacts filter = new FilterArtifacts(); + + filter.addFilter( new ScopeFilter( DependencyUtil.cleanToBeTokenizedString( this.includeScope ), + DependencyUtil.cleanToBeTokenizedString( this.excludeScope ) ) ); + + filter.addFilter( new TypeFilter( DependencyUtil.cleanToBeTokenizedString( this.includeTypes ), + DependencyUtil.cleanToBeTokenizedString( this.excludeTypes ) ) ); + + filter.addFilter( new ClassifierFilter( DependencyUtil.cleanToBeTokenizedString( this.includeClassifiers ), + DependencyUtil.cleanToBeTokenizedString( this.excludeClassifiers ) ) ); + + filter.addFilter( new GroupIdFilter( DependencyUtil.cleanToBeTokenizedString( this.includeGroupIds ), + DependencyUtil.cleanToBeTokenizedString( this.excludeGroupIds ) ) ); + + filter.addFilter( new ArtifactIdFilter( DependencyUtil.cleanToBeTokenizedString( this.includeArtifactIds ), + DependencyUtil.cleanToBeTokenizedString( this.excludeArtifactIds ) ) ); + + return filter; + } + + protected Set resolveDependencyArtifacts( final MavenProject theProject ) throws ArtifactResolutionException, ArtifactNotFoundException, InvalidDependencyVersionException { - Set artifacts = theProject.createArtifacts( this.factory, Artifact.SCOPE_TEST, - new ScopeArtifactFilter( Artifact.SCOPE_TEST ) ); + final Set artifacts = + theProject.createArtifacts( this.factory, Artifact.SCOPE_TEST, + new ScopeArtifactFilter( Artifact.SCOPE_TEST ) ); - for ( Artifact artifact : artifacts ) + for ( final Artifact artifact : artifacts ) { // resolve the new artifact this.resolver.resolve( artifact, this.remoteRepos, this.getLocal() ); @@ -100,15 +165,15 @@ public abstract class AbstractResolveMoj * @throws InvalidDependencyVersionException * */ - protected Set resolveArtifactDependencies( Artifact artifact ) + protected Set resolveArtifactDependencies( final Artifact artifact ) throws ArtifactResolutionException, ArtifactNotFoundException, ProjectBuildingException, InvalidDependencyVersionException { - Artifact pomArtifact = + final Artifact pomArtifact = this.factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "", "pom" ); - MavenProject pomProject = + final MavenProject pomProject = mavenProjectBuilder.buildFromRepository( pomArtifact, this.remoteRepos, this.getLocal() ); return resolveDependencyArtifacts( pomProject ); Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolvePluginsMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolvePluginsMojo.java?rev=1448351&r1=1448350&r2=1448351&view=diff ============================================================================== --- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolvePluginsMojo.java (original) +++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/resolvers/ResolvePluginsMojo.java Wed Feb 20 19:02:48 2013 @@ -19,6 +19,13 @@ package org.apache.maven.plugin.dependen * under the License. */ +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; @@ -31,16 +38,11 @@ import org.apache.maven.plugins.annotati import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.artifact.InvalidDependencyVersionException; +import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter; +import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts; import org.codehaus.plexus.util.IOUtil; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - /** * Goal that resolves all project plugins and reports and their dependencies. * @@ -78,21 +80,23 @@ public class ResolvePluginsMojo try { - Set plugins = resolvePluginArtifacts(); + final Set plugins = resolvePluginArtifacts(); if ( this.outputFile != null ) { - outputFile.getParentFile().mkdirs(); + outputFile.getParentFile() + .mkdirs(); outputWriter = new FileWriter( outputFile ); } - for ( Artifact plugin : plugins ) + for ( final Artifact plugin : plugins ) { String logStr = "Plugin Resolved: " + DependencyUtil.getFormattedFileName( plugin, false ); if ( !silent ) { - this.getLog().info( logStr ); + this.getLog() + .info( logStr ); } if ( outputWriter != null ) @@ -103,14 +107,15 @@ public class ResolvePluginsMojo if ( !excludeTransitive ) { - for ( Artifact artifact : resolveArtifactDependencies( plugin ) ) + for ( final Artifact artifact : resolveArtifactDependencies( plugin ) ) { logStr = " Plugin Dependency Resolved: " + DependencyUtil.getFormattedFileName( artifact, false ); if ( !silent ) { - this.getLog().info( logStr ); + this.getLog() + .info( logStr ); } if ( outputWriter != null ) @@ -122,23 +127,27 @@ public class ResolvePluginsMojo } } } - catch ( IOException e ) + catch ( final IOException e ) { throw new MojoExecutionException( "Nested:", e ); } - catch ( ArtifactResolutionException e ) + catch ( final ArtifactResolutionException e ) { throw new MojoExecutionException( "Nested:", e ); } - catch ( ArtifactNotFoundException e ) + catch ( final ArtifactNotFoundException e ) { throw new MojoExecutionException( "Nested:", e ); } - catch ( ProjectBuildingException e ) + catch ( final ProjectBuildingException e ) { throw new MojoExecutionException( "Nested:", e ); } - catch ( InvalidDependencyVersionException e ) + catch ( final InvalidDependencyVersionException e ) + { + throw new MojoExecutionException( "Nested:", e ); + } + catch ( final ArtifactFilterException e ) { throw new MojoExecutionException( "Nested:", e ); } @@ -155,25 +164,47 @@ public class ResolvePluginsMojo * @return set of resolved plugin artifacts. * @throws ArtifactResolutionException * @throws ArtifactNotFoundException + * @throws ArtifactFilterException */ + @SuppressWarnings( "unchecked" ) protected Set resolvePluginArtifacts() - throws ArtifactResolutionException, ArtifactNotFoundException + throws ArtifactResolutionException, ArtifactNotFoundException, ArtifactFilterException { - @SuppressWarnings( "unchecked" ) Set plugins = project.getPluginArtifacts(); - @SuppressWarnings( "unchecked" ) Set reports = project.getReportArtifacts(); + final Set plugins = project.getPluginArtifacts(); + final Set reports = project.getReportArtifacts(); Set artifacts = new HashSet(); artifacts.addAll( reports ); artifacts.addAll( plugins ); - for ( Artifact artifact : artifacts ) + final FilterArtifacts filter = getPluginArtifactsFilter(); + artifacts = filter.filter( artifacts ); + + // final ArtifactFilter filter = getPluginFilter(); + for ( final Artifact artifact : new HashSet( artifacts ) ) { + // if ( !filter.include( artifact ) ) + // { + // final String logStr = + // String.format( " Plugin SKIPPED: %s", DependencyUtil.getFormattedFileName( artifact, false ) ); + // + // if ( !silent ) + // { + // this.getLog() + // .info( logStr ); + // } + // + // artifacts.remove( artifact ); + // continue; + // } + // resolve the new artifact this.resolver.resolve( artifact, this.remotePluginRepositories, this.getLocal() ); } return artifacts; } + @Override protected ArtifactsFilter getMarkedArtifactFilter() { return null;