Filter out test-scoped resolved dependencies before looking at transitive dependencies
@@ -273,12 +273,15 @@ public abstract class AbstractLibertySupport extends MojoSupport {
ArtifactItem item = createArtifactItem(artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getVersion());
artifact = getArtifact(item);
}
+ // Ignore test-scoped artifacts, by design
+ if (!"test".equals(artifact.getScope())) {
log.debug("Found resolved dependency from project dependencies: " + artifact.getGroupId() + ":"
+ artifact.getArtifactId() + ":" + artifact.getVersion());
resolvedDependencies.add(artifact);
findTransitiveDependencies(artifact, getProject().getArtifacts(), resolvedDependencies);
}
}
+ }
if (resolvedDependencies.isEmpty() && getProject().getDependencyManagement() != null) {
// if project has dependencyManagement section
@@ -291,6 +294,8 @@ public abstract class AbstractLibertySupport extends MojoSupport {
(dependency.getArtifactId().equals(compareArtifactId)))) {
ArtifactItem item = createArtifactItem(dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), dependency.getVersion());
Artifact artifact = getArtifact(item);
+ // Ignore test-scoped artifacts, by design
+ if (!"test".equals(artifact.getScope())) {
log.debug("Found resolved dependency from project dependencyManagement " + dependency.getGroupId() + ":"
+ dependency.getArtifactId() + ":" + dependency.getVersion());
resolvedDependencies.add(artifact);
@@ -298,19 +303,11 @@ public abstract class AbstractLibertySupport extends MojoSupport {
}
}
}
-
- // Remove test scoped dependencies
- Set<Artifact> dependenciesWithoutTest = new HashSet<Artifact>();
- for (Artifact artifact : resolvedDependencies) {
- if (!"test".equals(artifact.getScope())) {
- dependenciesWithoutTest.add(artifact);
- }
}
- resolvedDependencies = dependenciesWithoutTest;
if (resolvedDependencies.isEmpty()) {
// No matching artifacts were found in the resolved dependencies. Send warning.
- log.warn("Unable to find artifact matching groupId "+ groupId +", artifactId "+artifactId+", and version "+version+" in either project dependencies or in project dependencyManagement.");
+ log.warn("Unable to find artifact matching groupId "+ groupId +", artifactId "+artifactId+" of any version in either project dependencies or in project dependencyManagement (note test-scoped dependencies are excluded).");
}
}
