@Override
@SuppressWarnings("unchecked")
public void validate() throws DeploymentFailureException {
super.validate();
if (artifactId == null) {
throw new DeploymentFailureException("deploy-artifact must specify the artifactId");
}
if (groupId == null) {
throw new DeploymentFailureException("deploy-artifact must specify the groupId");
}
final Set<Artifact> dependencies = project.getArtifacts();
// Allows provided dependencies to be seen
dependencies.addAll(project.getDependencyArtifacts());
Artifact artifact = null;
for (final Artifact a : dependencies) {
if (a.getArtifactId().equals(artifactId) &&
a.getGroupId().equals(groupId)) {
artifact = a;
break;
}
}
if (artifact == null) {
throw new DeploymentFailureException("Could not resolve artifact to deploy " + groupId + ":" + artifactId);
}
file = artifact.getFile();
}