Author: gertv Date: Wed Feb 9 15:06:36 2011 New Revision: 1068926 URL: http://svn.apache.org/viewvc?rev=1068926&view=rev Log: KARAF-440: features-maven-plugin:validate throws NPE in Maven 3
Modified: karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java Modified: karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java?rev=1068926&r1=1068925&r2=1068926&view=diff ============================================================================== --- karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java (original) +++ karaf/branches/karaf-2.2.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java Wed Feb 9 15:06:36 2011 @@ -40,6 +40,7 @@ import org.apache.maven.artifact.Artifac import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; +import org.apache.maven.artifact.resolver.ArtifactCollector; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.DefaultArtifactCollector; @@ -77,6 +78,15 @@ public class ValidateFeaturesMojo extend private DependencyTreeBuilder dependencyTreeBuilder; /** + * The ArtifactCollector provided by Maven at runtime + * + * @component + * @required + * @readonly + */ + private ArtifactCollector collector; + + /** * The file to generate * * @parameter default-value="${project.build.directory}/classes/features.xml" @@ -241,7 +251,7 @@ public class ValidateFeaturesMojo extend return true; } - }, new DefaultArtifactCollector()); + }, collector); tree.accept(new DependencyNodeVisitor() { public boolean endVisit(DependencyNode node) { // we want the next sibling too