in maven-plugin/src/main/java/com/spotify/missinglink/maven/CheckMojo.java [194:256]
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("skipping plugin execution since missinglink.skip=true");
return;
}
// when verbose flag is set, log detailed messages to info log. otherwise log to debug. This is
// so that verbose output from this plugin can be seen easily without having to specify mvn -X.
final Consumer<String> log = verbose ? msg -> getLog().info(msg) : msg -> getLog().debug(msg);
logDependencies(log);
final Set<ConflictCategory> categoriesToInclude;
try {
categoriesToInclude =
includeCategories.stream().map(ConflictCategory::valueOf).collect(Collectors.toSet());
} catch (IllegalArgumentException e) {
getLog().error(e);
throw new MojoExecutionException(
"Invalid value(s) for 'includeCategories': "
+ includeCategories
+ ". "
+ "Valid choices are: "
+ Joiner.on(", ").join(ConflictCategory.values()));
}
if (!ignoreDestinationPackages.isEmpty() && !targetDestinationPackages.isEmpty()) {
throw new MojoExecutionException(
"Either ignoreDestinationPackages or targetDestinationPackages can be set, "
+ "but not both.");
}
if (!ignoreSourcePackages.isEmpty() && !targetSourcePackages.isEmpty()) {
throw new MojoExecutionException(
"Either ignoreSourcePackages or targetSourcePackages can be set, " + "but not both.");
}
Collection<Conflict> conflicts = loadArtifactsAndCheckConflicts();
final int initialCount = conflicts.size();
conflicts = filterConflicts(conflicts, categoriesToInclude);
if (conflicts.isEmpty()) {
getLog().info("No conflicts found");
} else {
String warning = conflicts.size() + " conflicts found!";
if (initialCount != conflicts.size()) {
warning += " (" + initialCount + " conflicts were found before applying filters)";
}
getLog().warn(warning);
outputConflicts(conflicts);
if (failOnConflicts) {
final String message =
conflicts.size()
+ " class/method conflicts found between source "
+ "code in this project and the runtime dependencies from the Maven"
+ " project. Look above for specific descriptions of each conflict";
throw new MojoFailureException(message);
}
}
}