Index: src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java (revision 935208) +++ src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java (working copy) @@ -17,8 +17,11 @@ import java.io.File; import java.util.HashSet; +import java.util.Iterator; import java.util.Set; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.dependency.utils.DependencyStatusSets; import org.apache.maven.plugin.dependency.utils.DependencyUtil; @@ -271,6 +274,8 @@ throw new MojoExecutionException( e.getMessage(), e ); } + artifacts = replaceIncompleteArtifacts(artifacts); + // transform artifacts if classifier is set DependencyStatusSets status = null; if ( StringUtils.isNotEmpty( classifier ) ) @@ -286,6 +291,35 @@ } /** + * Replace artifacts that have not been packaged yet. This occurs if the artifact is + * part of the reactor build and the compile phase has been executed, but not the + * the package phase. These artifacts will be replaced by new artifact objects + * resolved from the repository. + * + * @param artifacts the original sets of {@link Artifact} objects + * @return a set of {@link Artifact} objects built as described above + * @throws MojoExecutionException + */ + private Set replaceIncompleteArtifacts(Set artifacts) throws MojoExecutionException { + Set result = new HashSet(); + for (Iterator it = artifacts.iterator(); it.hasNext(); ) { + Artifact artifact = (Artifact)it.next(); + File file = artifact.getFile(); + if (file != null && file.isDirectory()) { + artifact = factory.createDependencyArtifact(artifact.getGroupId(), artifact.getArtifactId(), + artifact.getVersionRange(), artifact.getType(), artifact.getClassifier(), artifact.getScope()); + try { + resolver.resolve( artifact, remoteRepos, getLocal() ); + } catch (AbstractArtifactResolutionException e) { + throw new MojoExecutionException( e.getMessage(), e ); + } + } + result.add(artifact); + } + return result; + } + + /** * * Transform artifacts *