@Test public void testIgnoreDestinationPackages() throws Exception { final CalledMethod callee = new CalledMethodBuilder() .owner(TypeDescriptors.fromClassName("com/foo/Bar")) .descriptor(new MethodDescriptorBuilder() .returnType(TypeDescriptors.fromRaw("Ljava/lang/String;")) .name("bat") .parameterTypes(ImmutableList.of()) .build()) .build(); final DeclaredMethod caller = new DeclaredMethodBuilder() .methodCalls(ImmutableSet.of()) .fieldAccesses(ImmutableSet.of()) .descriptor(new MethodDescriptorBuilder() .returnType(TypeDescriptors.fromRaw("Ljava/lang/String;")) .name("bat") .parameterTypes(ImmutableList.of(TypeDescriptors.fromRaw("I"))) .build()) .build(); setMockConflictResults(ImmutableList.of( conflict(ConflictCategory.CLASS_NOT_FOUND, TypeDescriptors.fromClassName("com/Whatever"), caller, callee, "class com/foo/Bar not found") )); final CheckMojo mojo = getMojo("ignore-destination-packages"); assertThat(mojo.ignoreDestinationPackages) .hasSize(1) .contains(new IgnoredPackage("com.foo", true)); mojo.execute(); }
public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("skipping plugin execution since missinglink.skip=true"); return; } 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())); } 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); } } }
CheckMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("skipping plugin execution since missinglink.skip=true"); return; } 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())); } 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); } } } }
CheckMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("skipping plugin execution since missinglink.skip=true"); return; } 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())); } 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); } } }  }
CheckMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("skipping plugin execution since missinglink.skip=true"); return; } 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())); } 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); } } }  void execute(); }
CheckMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("skipping plugin execution since missinglink.skip=true"); return; } 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())); } 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); } } }  void execute();  }