Author: gertv Date: Wed Feb 9 15:07:15 2011 New Revision: 1068928 URL: http://svn.apache.org/viewvc?rev=1068928&view=rev Log: KARAF-440: features-maven-plugin:validate throws NPE in Maven 3
Modified: karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java Modified: karaf/branches/karaf-2.1.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.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java?rev=1068928&r1=1068927&r2=1068928&view=diff ============================================================================== --- karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java (original) +++ karaf/branches/karaf-2.1.x/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java Wed Feb 9 15:07:15 2011 @@ -39,6 +39,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; @@ -76,6 +77,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" @@ -220,7 +230,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