Skip to content

Commit

Permalink
#125 do not throw 'could not resolve dependency...' exception when fi…
Browse files Browse the repository at this point in the history
…le for optional dependency could not be resolved
  • Loading branch information
siom79 committed Mar 20, 2016
1 parent 33f8ad0 commit b27660a
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,13 @@ private List<File> resolveDependencyToFile(String parameterName, Dependency depe
getLog().debug(parameterName + ": " + descriptor);
Set<Artifact> artifacts = resolveArtifact(dependency, mavenParameters, transitively, pluginParameters, configurationVersion);
for (Artifact artifact : artifacts) {
File file = artifact.getFile();
if (file != null) {
files.add(file);
} else {
throw new MojoFailureException(String.format("Could not resolve dependency with descriptor '%s'.", descriptor));
if (!artifact.isOptional()) { //skip optional artifacts because getFile() will return null
File file = artifact.getFile();
if (file != null) {
files.add(file);
} else {
throw new MojoFailureException(String.format("Could not resolve dependency with descriptor '%s'.", descriptor));
}
}
}
if (files.size() == 0) {
Expand Down

0 comments on commit b27660a

Please sign in to comment.